Adam Litke has uploaded a new change for review.

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 dictionaries.

Change-Id: I01d142a68903048accc95eb04d9930c326965db0
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1109920
Signed-off-by: Adam Litke <[email protected]>
---
M vdsm/virt/vm.py
1 file changed, 12 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/64/31364/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index edabda2..0706ea7 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -5233,7 +5233,7 @@
                 return job
         raise LookupError("No block job found for drive '%s'", drive.name)
 
-    def trackBlockJob(self, jobID, drive, base, top, strategy):
+    def trackBlockJob(self, jobID, drive, base, top, chain, strategy):
         driveSpec = dict([(k, drive[k]) for k in
                          'poolID', 'domainID', 'imageID', 'volumeID'])
         with self._confLock:
@@ -5243,7 +5243,7 @@
                 newJob = {'jobID': jobID, 'disk': driveSpec,
                           'baseVolume': base, 'topVolume': top,
                           'strategy': strategy, 'blockJobType': 'commit',
-                          'chain': self._driveGetActualVolumeChain(drive)}
+                          'chain': chain}
                 self.conf['_blockJobs'][jobID] = newJob
             else:
                 self.log.error("Cannot add block job %s.  A block job with id "
@@ -5352,10 +5352,12 @@
             return errCode['imageErr']
 
         # Check that libvirt exposes full volume chain information
-        if self._driveGetActualVolumeChain(drive) is None:
+        ret = self._driveGetActualVolumeChain(drive)
+        if ret is None:
             self.log.error("merge: libvirt does not support volume chain "
                            "monitoring.  Unable to perform live merge.")
             return errCode['mergeErr']
+        chain = [v['id'] for v in ret]
 
         # If engine passes empty values for baseVolUUID and topVolUUID then we
         # will just try to recover from a previous merge.  Just create a fake
@@ -5364,7 +5366,7 @@
             with self._jobsLock:
                 try:
                     self.trackBlockJob(jobUUID, drive, baseVolUUID, topVolUUID,
-                                       'commit')
+                                       chain, 'commit')
                 except BlockJobExistsError:
                     self.log.error("A block job is active on this disk")
                     return errCode['mergeErr']
@@ -5414,7 +5416,7 @@
         with self._jobsLock:
             try:
                 self.trackBlockJob(jobUUID, drive, baseVolUUID, topVolUUID,
-                                   'commit')
+                                   chain, 'commit')
             except BlockJobExistsError:
                 self.log.error("A block job is already active on this disk")
                 return errCode['mergeErr']
@@ -5472,7 +5474,8 @@
                 break
             sourceAttr = ('file', 'dev')[drive.blockDev]
             path = sourceXML.getAttribute(sourceAttr)
-            volChain.insert(0, pathToVolID(drive, path))
+            info = {'id': pathToVolID(drive, path)}
+            volChain.insert(0, info)
             bsXML = findElement(diskXML, 'backingStore')
             if not bsXML:
                 break
@@ -5491,12 +5494,13 @@
             return
 
         curVols = [x['volumeID'] for x in drive.volumeChain]
-        volumes = self._driveGetActualVolumeChain(drive)
-        if volumes is None:
+        ret = self._driveGetActualVolumeChain(drive)
+        if ret is None:
             self.log.debug("Unable to determine volume chain. Skipping volume "
                            "chain synchronization for drive %s", drive.name)
             return
 
+        volumes = [v['id'] for v in ret]
         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/31364
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I01d142a68903048accc95eb04d9930c326965db0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to