Hello Nir Soffer, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/32319
to review the following change.
Change subject: Live Merge: Return more info from _driveGetActualVolumeChain
......................................................................
Live Merge: Return more info from _driveGetActualVolumeChain
In followup patches, we want to return more information about each path
component from _driveGetActualVolumeChain. We need the actual path as
given in the domain XML in order to properly update our metadata after
an active layer merge. We also want to use this function to return high
write watermark information for block volumes. This patch just converts
the format returned by _driveGetActualVolumeChain from a simple list to
a list of named tuples.
Change-Id: I01d142a68903048accc95eb04d9930c326965db0
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/31364
Reviewed-by: Nir Soffer <nsoffer(a)redhat.com>
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 12 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/19/32319/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 4806dab..7017eef 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -20,6 +20,7 @@
# stdlib imports
+from collections import namedtuple
from contextlib import contextmanager
from copy import deepcopy
from operator import itemgetter
@@ -212,6 +213,9 @@
class UpdatePortMirroringError(Exception):
pass
+
+
+VolumeChainEntry = namedtuple('VolumeChainEntry', ['uuid'])
class VmStatsThread(sampling.AdvancedStatsThread):
@@ -5555,8 +5559,7 @@
except LookupError:
newJob = {'jobID': jobID, 'disk': driveSpec,
'baseVolume': base, 'topVolume': top,
- 'strategy': strategy, 'blockJobType':
'commit',
- 'chain': self._driveGetActualVolumeChain(drive)}
+ 'strategy': strategy, 'blockJobType':
'commit'}
self.conf['_blockJobs'][jobID] = newJob
else:
self.log.error("Cannot add block job %s. A block job with id
"
@@ -5665,7 +5668,8 @@
return errCode['imageErr']
# Check that libvirt exposes full volume chain information
- if self._driveGetActualVolumeChain(drive) is None:
+ chain = self._driveGetActualVolumeChain(drive)
+ if chain is None:
self.log.error("merge: libvirt does not support volume chain "
"monitoring. Unable to perform live merge.")
return errCode['mergeErr']
@@ -5781,7 +5785,8 @@
break
sourceAttr = ('file', 'dev')[drive.blockDev]
path = sourceXML.getAttribute(sourceAttr)
- volChain.insert(0, pathToVolID(drive, path))
+ entry = VolumeChainEntry(pathToVolID(drive, path))
+ volChain.insert(0, entry)
bsXML = findElement(diskXML, 'backingStore')
if not bsXML:
break
@@ -5800,12 +5805,13 @@
return
curVols = [x['volumeID'] for x in drive.volumeChain]
- volumes = self._driveGetActualVolumeChain(drive)
- if volumes is None:
+ chain = self._driveGetActualVolumeChain(drive)
+ if chain is None:
self.log.debug("Unable to determine volume chain. Skipping volume
"
"chain synchronization for drive %s", drive.name)
return
+ volumes = [entry.uuid for entry in chain]
self.log.debug("vdsm chain: %s, libvirt chain: %s", curVols, volumes)
# Ask the storage to sync metadata according to the new chain
--
To view, visit
http://gerrit.ovirt.org/32319
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I01d142a68903048accc95eb04d9930c326965db0
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>