Adam Litke has uploaded a new change for review.
Change subject: virt: Restore BC for block type live snapshots
......................................................................
virt: Restore BC for block type live snapshots
Commit 02741ce introduced a regression in older hosts running libvirt <
1.2.2 where libvirt rejects the type='block' and source/dev combination.
Eric Blake suggested that this could be worked around by supplying the
old format and new format in the domainshapshot XML document. This
union would continue to work as before on old hosts but would pick up
the correct block snapshot behavior on newer versions. Basically, we
still express the disk type but we repeat the newPath inside both a dev
and file attribute.
Bug-Url:
https://bugzilla.redhat.com/show_bug.cgi?id=1115126
Change-Id: I85290f17842ada6c04695bf45ffd1b1108c63d55
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 7 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/67/29567/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 6e937fc..7cca83e 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4022,11 +4022,14 @@
disk = XMLElement('disk', name=vmDev, snapshot='external',
type=sourceType)
+ # Libvirt versions before 1.2.2 do not understand 'type' and treat
+ # all snapshots as if they are type='file'. In order to ensure
+ # proper handling of block snapshots in modern libvirt versions,
+ # we specify type='block' and dev=path for block volumes but we
+ # always speficy the file=path for backwards compatibility.
+ args = {'type': sourceType, 'file': newPath}
if sourceType == 'block':
- args = {'dev': newPath}
- elif sourceType == 'file':
- args = {'file': newPath}
- args['type'] = sourceType
+ args['dev'] = newPath
disk.appendChildWithArgs('source', **args)
return disk
--
To view, visit
http://gerrit.ovirt.org/29567
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I85290f17842ada6c04695bf45ffd1b1108c63d55
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>