snapshots with lvm

Bug #1083714 reported by Adam Jacob Muller
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Undecided
Unassigned

Bug Description

inside nova/virt/libvirt/driver.py/snapshot()

        xml_desc = virt_dom.XMLDesc(0)
        domain = etree.fromstring(xml_desc)
        source = domain.find('devices/disk/source')
        disk_path = source.get('file')

This is wrong because when LVM-backed disks are used:
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source dev='/dev/vg/instance-000003d1_disk'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </disk>

It should therefore (with some tests obv) be:
disk_path = source.get('dev')

However, even if this is corrected:

# qemu-img snapshot -c foo /dev/vg/instance-000003d1_disk
qemu-img: Could not create snapshot 'foo': -95 (Operation not supported)

qemu-img doesn't seem to support snapshotting on lvm disks (and that doesn't necessarily seem like the right thing anyway)

Michael Still (mikal)
Changed in nova:
status: New → Triaged
importance: Undecided → Critical
Revision history for this message
Adam Jacob Muller (78luphr0rnk2nuqimstywepozxn9kl19tqh0tx66b5dki1xxsh5mkz9gl21a5rlwfnr8jn6ln0m3jxne2k9x1ohg85w3jabxlrqbgszpjpwcmvk-launchpad) wrote :

My, "this works but probably isn't even 100% right for LVM and DEFINITELY isn't right for non-lvm cases" patch:

--- a/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py
+++ b/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py
@@ -821,29 +821,7 @@ class LibvirtDriver(driver.ComputeDriver):
         xml_desc = virt_dom.XMLDesc(0)
         domain = etree.fromstring(xml_desc)
         source = domain.find('devices/disk/source')
- disk_path = source.get('dev')
-
- LOG.debug("creating snapshot")
- out, err = utils.execute('lvcreate',
- '-s',disk_path,
- '-L','10G',
- '-n',"_snap_%s"%snapshot_name,
- run_as_root=True)
- snap_file = '/dev/%s/_snap_%s' % (FLAGS.libvirt_images_volume_group,snapshot_name)
- LOG.debug("temporary_chown(%s) to %s" % (snap_file,os.getuid()))
- with utils.temporary_chown(snap_file):
- snap_h=open(snap_file,"r")
- LOG.debug("sending snapshot image to image service")
- image_service.update(context,
- image_href,
- metadata,
- snap_h)
- snap_h.close()
- out, err = utils.execute('lvremove',
- '-f',snap_file,
- run_as_root=True)
-
- return None
+ disk_path = source.get('file')

         (state, _max_mem, _mem, _cpus, _t) = virt_dom.info()
         state = LIBVIRT_POWER_STATE[state]

Revision history for this message
Thierry Carrez (ttx) wrote :

Support for snapshots on LVM and raw was added in grizzly-1:
https://blueprints.launchpad.net/nova/+spec/snapshots-for-everyone

It looks like your concerns have been adressed there, please reopen if you disagree.

Changed in nova:
importance: Critical → Undecided
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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