Libvirt/KVM snapshot only in RAW image format ?

Asked by Édouard Thuleau

When I create an image from a running instance with the Libvirt driver, nova-compute create a copy of the QCOW2 running image in RAW image format.
Why it converts the QCOW2 image to RAW image ?

I try to change the qemu-img convert command (in method 'snapshot' of class 'LibvirtConnection') to create snapshot in QCOW2 format. The image is correctly created but nova fails to boot the new image. I can see in nova-compute logs a warning about it cannot inject key into image.
I check if I can manually boot with KVM this image and it works nicely.

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Compute (nova) Edit question
Assignee:
No assignee Edit question
Solved by:
Édouard Thuleau
Solved:
Last query:
Last reply:
Revision history for this message
Brian Lamar (blamar) said :
#1

Can you provide the relevant nova-compute logs? I suspect the way we're currently injecting information into disks does not work with non-raw image, but failure information would help with debugging. What you're doing is possible, so hopefully it's just a matter of figuring out exactly what is failing and going from there.

Revision history for this message
Vish Ishaya (vishvananda) said :
#2

The qcow images used in the instances directory are copy-on-write images. If you modified the original command, you may be getting a copy-on-write image as well. That is the only reason i can think that it wouldn't boot. QCow2 images should boot fine as long as they don't have a backing file. Perhaps change the snapshot command to still create a raw image but then convert it into a qcow2 before uploading it?

Vish

On Aug 8, 2011, at 3:11 AM, Edouard Thuleau wrote:

> New question #167301 on OpenStack Compute (nova):
> https://answers.launchpad.net/nova/+question/167301
>
> When I create an image from a running instance with the Libvirt driver, nova-compute create a copy of the QCOW2 running image in RAW image format.
> Why it converts the QCOW2 image to RAW image ?
>
> I try to change the qemu-img convert command (in method 'snapshot' of class 'LibvirtConnection') to create snapshot in QCOW2 format. The image is correctly created but nova fails to boot the new image. I can see in nova-compute logs a warning about it cannot inject key into image.
> I check if I can manually boot with KVM this image and it works nicely.
>
> --
> You received this question notification because you are a member of Nova
> Core, which is an answer contact for OpenStack Compute (nova).

Revision history for this message
Édouard Thuleau (ethuleau) said :
#3

Ok, I made a mistake.
It works nicely if I change the command 'qemu-img convert' by :
qemu_img_cmd = (FLAGS.qemu_img, 'convert', '-f', 'qcow2', '-O', 'qcow2', '-s', snapshot_name, disk_path, out_path)
in method 'snapshot' of class 'LibvirtConnection'. The new converted QCow2 file doesn't depend on the backing file.

Do you think it's interesting to implement that. How I can propose this patch ? Through a wishlist bug ?

Revision history for this message
Vish Ishaya (vishvananda) said :
#4

You can go ahead and make a bug and propose it. Probably it should be a flag, only because people may want their snapshots as raw images for compatibility with other hypervisors.

Vish

On Aug 10, 2011, at 7:11 AM, Edouard Thuleau wrote:

> Question #167301 on OpenStack Compute (nova) changed:
> https://answers.launchpad.net/nova/+question/167301
>
> Status: Answered => Open
>
> Edouard Thuleau is still having a problem:
> Ok, I made a mistake.
> It works nicely if I change the command 'qemu-img convert' by :
> qemu_img_cmd = (FLAGS.qemu_img, 'convert', '-f', 'qcow2', '-O', 'qcow2', '-s', snapshot_name, disk_path, out_path)
> in method 'snapshot' of class 'LibvirtConnection'. The new converted QCow2 file doesn't depend on the backing file.
>
> Do you think it's interesting to implement that. How I can propose this
> patch ? Through a wishlist bug ?
>
> --
> You received this question notification because you are a member of Nova
> Core, which is an answer contact for OpenStack Compute (nova).

Revision history for this message
Édouard Thuleau (ethuleau) said :
#5