Hello Nir Soffer, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/32320
to review the following change.
Change subject: Live Merge: Update path using libvirt supplied value
......................................................................
Live Merge: Update path using libvirt supplied value
When libvirt pivots the active layer after a live merge, the live XML is
updated to reflect the path of the new active layer. The new path is
copied from the backingStore pointer of the old active layer. Since
that is a relative path, libvirt makes it absolute but it will not
remove the '../' path component since that is not always correct (even
though it would be correct for our environment). When syncing the
volume chain, we must use the same path as libvirt does, otherwise
future calls to libvirt may fail.
Change-Id: Ie341333ad934645c0fe4f2fd31733c459d306d9a
Bug-Url:
https://bugzilla.redhat.com/show_bug.cgi?id=1109920
Signed-off-by: Adam Litke <alitke(a)redhat.com>
Reviewed-on:
http://gerrit.ovirt.org/31365
Reviewed-by: Nir Soffer <nsoffer(a)redhat.com>
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 8 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/32320/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 7017eef..63a2d00 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -215,7 +215,7 @@
pass
-VolumeChainEntry = namedtuple('VolumeChainEntry', ['uuid'])
+VolumeChainEntry = namedtuple('VolumeChainEntry', ['uuid',
'path'])
class VmStatsThread(sampling.AdvancedStatsThread):
@@ -5785,7 +5785,7 @@
break
sourceAttr = ('file', 'dev')[drive.blockDev]
path = sourceXML.getAttribute(sourceAttr)
- entry = VolumeChainEntry(pathToVolID(drive, path))
+ entry = VolumeChainEntry(pathToVolID(drive, path), path)
volChain.insert(0, entry)
bsXML = findElement(diskXML, 'backingStore')
if not bsXML:
@@ -5812,6 +5812,7 @@
return
volumes = [entry.uuid for entry in chain]
+ activePath = chain[-1].path
self.log.debug("vdsm chain: %s, libvirt chain: %s", curVols, volumes)
# Ask the storage to sync metadata according to the new chain
@@ -5829,9 +5830,13 @@
# If the active layer changed:
# Update the disk path, volumeID, and volumeInfo members
volInfo = getVolumeInfo(device, volumeID)
- device['path'] = drive.path = volInfo['path']
+ # Path must be set with the value being used by libvirt
+ device['path'] = drive.path = volInfo['path'] = activePath
device['volumeID'] = drive.volumeID = volumeID
device['volumeInfo'] = drive.volumeInfo = volInfo
+ for v in device['volumeChain']:
+ if v['volumeID'] == volumeID:
+ v['path'] = activePath
# Remove any components of the volumeChain which are no longer present
newChain = [x for x in device['volumeChain']
--
To view, visit
http://gerrit.ovirt.org/32320
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie341333ad934645c0fe4f2fd31733c459d306d9a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>