snapshots with lvm
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
inside nova/virt/
xml_desc = virt_dom.XMLDesc(0)
domain = etree.fromstrin
source = domain.
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/
<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/
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)
Changed in nova: | |
status: | New → Triaged |
importance: | Undecided → Critical |
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 python2. 7/dist- packages/ nova/virt/ libvirt/ driver. py driver. ComputeDriver) : g(xml_desc) find('devices/ disk/source' ) 'lvcreate' , snap_%s" %snapshot_ name, libvirt_ images_ volume_ group,snapshot_ name) "temporary_ chown(% s) to %s" % (snap_file, os.getuid( ))) _chown( snap_file) : open(snap_ file,"r" ) update( context, 'lvremove' ,
+++ b/usr/lib/
@@ -821,29 +821,7 @@ class LibvirtDriver(
xml_desc = virt_dom.XMLDesc(0)
domain = etree.fromstrin
source = domain.
- disk_path = source.get('dev')
-
- LOG.debug("creating snapshot")
- out, err = utils.execute(
- '-s',disk_path,
- '-L','10G',
- '-n',"_
- run_as_root=True)
- snap_file = '/dev/%s/_snap_%s' % (FLAGS.
- LOG.debug(
- with utils.temporary
- snap_h=
- LOG.debug("sending snapshot image to image service")
- image_service.
- image_href,
- metadata,
- snap_h)
- snap_h.close()
- out, err = utils.execute(
- '-f',snap_file,
- run_as_root=True)
-
- return None
+ disk_path = source.get('file')
(state, _max_mem, _mem, _cpus, _t) = virt_dom.info() POWER_STATE[ state]
state = LIBVIRT_