Comment 1 for bug 1083714

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]