Bug 1006159

Summary: [RFE] qemu-img: Add/improve support for VHD/VHDX format
Product: Red Hat Enterprise Linux 6 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Jeff Cody <jcody>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.5CC: areis, bsarathy, Jan.van.Eldik, jcody, juzhang, kwolf, luis.fernandez.alvarez, mkenneth, mrezanin, ondrejv, qzhang, rbalakri, rjones, rvokal, sdenham, stefanha, tlavigne, virt-maint
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: All   
Fixed In Version: qemu-kvm- Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: 879234
: 1088700 1090866 1090867 (view as bug list) Environment:
Last Closed: 2014-10-14 06:50:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 879234, 1007176, 1008755    
Bug Blocks: 961854, 977441, 1063559, 1088700, 1090866, 1090867    

Comment 1 Sibiao Luo 2013-09-10 06:55:16 UTC
Qemu-img should support image creation/convertion for VHD(X) image format in RHEL6.5, for v2v. Once this issue is fixed, then we will be able to use the qemu-img to create VHDX images.

Comment 9 Miroslav Rezanina 2014-07-25 07:51:00 UTC
Fixes already in build, patch not properly updated.

Comment 11 Sibiao Luo 2014-07-28 06:17:32 UTC
Verified this issue with qemu-kvm-rhev-

host info:
# uname -r && rpm -q qemu-kvm-rhev

#### scenarios 1.
Use qemu-img to create and read the vpc/vhdx image correctly, and then attach it in KVM as a second disk specified readonly=on.

1.Use qemu-img to create and read the vpc/vhdx image.
# qemu-img create -f vpc my-data-disk.vpc 10G
Formatting 'my-data-disk.vpc', fmt=vpc size=10737418240 
# qemu-img info my-data-disk.vpc
image: my-data-disk.vpc
file format: vpc
virtual size: 10G (10737893376 bytes)
disk size: 24K
cluster_size: 2097152
# qemu-img create -f vhdx my-data-disk.vhdx 10G
Formatting 'my-data-disk.vhdx', fmt=vhdx size=10737418240 log_size=1048576 block_size=0 block_state_zero=off 
# qemu-img info my-data-disk.vhdx
image: my-data-disk.vhdx
file format: vhdx
virtual size: 10G (10737418240 bytes)
disk size: 272K
cluster_size: 16777216
2.using QEMU, launch a guest with the VHDX data disk as a secondary disk.
e.g:...-drive file=/home/my-data-disk.vhdx,if=none,format=vhdx,id=drive-data-disk,cache=none,werror=stop,rerror=stop,readonly=on -device virtio-blk-pci,bus=pci.0,addr=0x7,drive=drive-data-disk,id=data-disk

after step 1, use qemu-img to create and read the vpc/vhdx image successfully.
after step 2, using QEMU to launch a guest with the VHDX data disk as a secondary disk(readonly) successfully.

#### scenarios 2.
Use Hyper-V to install OS and generate an image(clean dynamic & fixed image files), then convert it to qcow2/raw format via qemu-img and boot it in KVM environment.

1.Use Hyper-V to install OS and generate an image(clean dynamic & fixed image files).
2.convert it to qcow2/raw format via qemu-img.
# qemu-img convert -p -f vhdx RHEL-7.0.z-Server-x86_64.vhdx -O qcow2 RHEL-7.0.z-Server-x86_64.qcow2
3.boot it in KVM with simulate driver.
e.g:# /usr/libexec/qemu-kvm -M pc -cpu Opteron_G2 -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -usb -device usb-tablet,id=input0 -name sluo -uuid 990ea161-6b67-47b2-b803-19fb01d30d30 -rtc base=localtime,clock=host,driftfix=slew -drive file=/home/RHEL-7.0.z-Server-x86_64.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native -device ide-drive,drive=drive-system-disk,id=system-disk,bus=ide.0,unit=0 -k en-us -boot menu=on -qmp tcp:0:4444,server,nowait -serial unix:/tmp/ttyS0,server,nowait -vnc :1 -spice disable-ticketing,port=5931 -monitor stdio
4.reboot/shutdown/poweroff guest. 

after step 2, it convert successfully.
after step 3, boot up in KVM successfully.
after step 4, reboot/shutdown/poweroff VM successfully.

Base on above, this issue has been fixed correctly, move to VERIFIED status, please correct me if any mistake.

Best Regards,

Comment 12 errata-xmlrpc 2014-10-14 06:50:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.