Libvirt/KVM snapshot only in RAW image format

Bug #824433 reported by Édouard Thuleau
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Édouard Thuleau

Bug Description

With the virt driver Libvirt, the snapshot of an instance is convert into RAW disk format even if the original image is a QCow2 image.
Furthermore, the new image created by a snapshot take same 'disk_format' and 'container_format' as the original image. For example, a QCow2 image is instantiated and a snapshot of this image is created. The snapshot image is in RAW format but the metadata 'disk_format' of the snapshot image is 'QCow2'

I think, nova-compute should not convert the image for a snapshot. If the image is in QCow2 format, snapshots are in QCow2 format also. If the image is in RAW format, the snapshots are in RAW format also.

Perhaps, we can add a flag to force the snapshot format.

Related question: https://answers.launchpad.net/nova/+question/167301

I tested to 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'. It works nicely.

Related branches

Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Medium
status: New → Triaged
Changed in nova:
assignee: nobody → Doude (doude)
Changed in nova:
status: Triaged → In Progress
Revision history for this message
Édouard Thuleau (ethuleau) wrote :

I try to create patch for this bug.
What do you think about that patch ? About test flag ?
I'm not a developer so I prefer to have developer opinion before I prose it to merge.

Revision history for this message
Vish Ishaya (vishvananda) wrote :

I think a better solution would be to use the format of the original image.

Revision history for this message
Édouard Thuleau (ethuleau) wrote :

Ok.
By default, we can use the default original image format and propose flags to customize this.

Revision history for this message
Édouard Thuleau (ethuleau) wrote :

Nice Vish, I forget to check the flag 'use_cow_images'.
Perhaps adds new tests for other format (vmdk and vdi) ?

Do you think it could be an extension of OSAPI ? When we make a snapshot, the user could choose the image format.
Perhaps an new function call 'export image' ?

Revision history for this message
Vish Ishaya (vishvananda) wrote : Re: [Bug 824433] Libvirt/KVM snapshot only in RAW image format

Interesting idea. Might be a useful extension for sure.

On Sep 12, 2011, at 12:58 AM, Doude wrote:

> Nice Vish, I forget to check the flag 'use_cow_images'.
> Perhaps adds new tests for other format (vmdk and vdi) ?
>
> Do you think it could be an extension of OSAPI ? When we make a snapshot, the user could choose the image format.
> Perhaps an new function call 'export image' ?
>
> --
> You received this bug notification because you are a member of Nova Bug
> Team, which is subscribed to OpenStack Compute (nova).
> https://bugs.launchpad.net/bugs/824433
>
> Title:
> Libvirt/KVM snapshot only in RAW image format
>
> Status in OpenStack Compute (Nova):
> In Progress
>
> Bug description:
> With the virt driver Libvirt, the snapshot of an instance is convert into RAW disk format even if the original image is a QCow2 image.
> Furthermore, the new image created by a snapshot take same 'disk_format' and 'container_format' as the original image. For example, a QCow2 image is instantiated and a snapshot of this image is created. The snapshot image is in RAW format but the metadata 'disk_format' of the snapshot image is 'QCow2'
>
> I think, nova-compute should not convert the image for a snapshot. If
> the image is in QCow2 format, snapshots are in QCow2 format also. If
> the image is in RAW format, the snapshots are in RAW format also.
>
> Perhaps, we can add a flag to force the snapshot format.
>
> Related question: https://answers.launchpad.net/nova/+question/167301
>
> I tested to 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'. It works nicely.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nova/+bug/824433/+subscriptions

Thierry Carrez (ttx)
Changed in nova:
milestone: none → 2011.3
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.