Check the commented out in KVM.pm::copy_virtual_disk. I left a bunch of of code and comments in there while I was trying to figure out problems similar to what you're describing. Some of it may be helpful.

On 3/1/2013 1:35 PM, Dmitri Chebotarov wrote:
Hi

I've compiled qemu-1.4.0.
qemu-img in 1.4 still fails to convert $image.vmdk file, but works OK for 
$image-flat.vmdk files. To test it I changed the code in libvirt.pm to return 
$image-flat.vmdk for the file name. Did you have to adjust anything on your 
side for qemu-img to find $image-flat.vmdk to in $image.vmdk (1)?

Where did you edit? libvirt.pm::find_repository_image_file_paths() should return every file with $image in the name except $image.vmdk. This is just VMware's image metadata file. I haven't tested it but I think $image-flat.vmdk should be returned. We are using the code as it is in trunk. We are only converting from the images stored in the repository which are in 2gbsparse format, not from images in the datastore in monolithic *-flat.vmdk format.

BTW - I would advise against using the same datastore location for both VMware and KVM images. I wrote the module with the assumption that the datastore only contains KVM images. There may be conflicts if the KVM code finds additional files in the datastore which contain the image name. Also assumed is that when converting from vmdk to qcow2, the vmdk images reside in the image repository in 2gbsparse format.

The vcld.log has "copy on write virtual disk is not supported for the datastore 
image type: vmdk, creating full copy of master image file" message, I assume this 
means all VMware images running on KVM will use full copies, which is a lot of disk space 
(2).

Aha, I don't think vmprofile.imagetypeid is set correctly. Change it from vmdk to qcow2. This may be the cause of your overall problem. Try this first and test if vcld properly converts the vmdk to qcow2.


I've also compiled libvirt-1.0.3rc3 and linked /usr/libexec/qemu-kvm -> 
/usr/local/bin/qemu-system-x86_64. Before I was getting error message about 
qemu-kvm not supporting vmdk. I'm not entirely sure I needed to build new libvirt, 
but I worked OK.

With the changes above I was able to load VMware VM (vmdk) on KVM host (CentOS 
Linux as guest, will try Win later).

(There are some bugs in CentOS6 and libvirt-1.0.2/1.0.3rc3 with SELinux 
enabled, so SELinux is disabled on the VM Hosts).

Q.:

1. Should qemu-img work with $image.vmdk files? The $image.vmdk file is 
description files for $image-flat.vmdk. If qemu-img is not suppose to 'follow' 
to $image-flat.vmdk file, then this could be adjusted in libvirt.pm code.

2. Is there a way to make a linked clone from .vmdk file (i.e. copy of write 
disk)? Can .vmdk file be converted to .qcow2 file as linked clone?

Yes. This is what the code does when things are working properly. I don't think KVM can run linked clones directly from a vmdk. It must be converted to qcow2 first.


I would like to stay with CentOS6 as host OS if possible, but if #2 above works 
in Fedora and I cannot make it work in CentOS then I'll try Fedora 16 as host.

I'd like to know how to get things working on CentOS/RHEL as well. We mainly use these and are only using Fedora because of the image conversion problems.

Thanks,
Andy


Reply via email to