Mark Huth has uploaded a new change for review. Change subject: BZ890983 - allow dumpStorageTable to handle images with multiple leaf volumes ......................................................................
BZ890983 - allow dumpStorageTable to handle images with multiple leaf volumes Change-Id: Ifa932a47a91caa1a8284ea58678367ca77ed2d9a Signed-off-by: Mark Huth <[email protected]> --- M vdsm/dumpStorageTable.py.in 1 file changed, 33 insertions(+), 25 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/03/12703/1 diff --git a/vdsm/dumpStorageTable.py.in b/vdsm/dumpStorageTable.py.in index a148a4d..a7c1422 100644 --- a/vdsm/dumpStorageTable.py.in +++ b/vdsm/dumpStorageTable.py.in @@ -109,7 +109,8 @@ volParents = {} - leafvol = '' + # Its possible for an image to have multiple leaf volumes, eg when previewing a snapshot + leafvols = [] for vol in volumes['uuidlist']: res = self.serverConncetion.getVolumeInfo(sd, pool, image, vol) @@ -118,37 +119,40 @@ self.volumesList[imageDomVol] = [] if res['info']['voltype'] == 'LEAF': - leafvol = vol + leafvols.append(vol) if res['info']['voltype'] == 'SHARED': - leafvol = vol + leafvols.append(vol) self.volumesList[imageDomVol].append('Template') - self.imagesList[imageDom] = self._buildVolumesChain(leafvol, vollen, + self.imagesList[imageDom] = self._buildVolumesChain(leafvols, vollen, volParents, sd, image) - def _buildVolumesChain(self, leafvol, vollen, volParents, sd, image): + def _buildVolumesChain(self, leafvols, vollen, volParents, sd, image): - volChain = vollen * [None] + volChain = [] + for leafvol in leafvols: + # insert an empty 'volume' if there are multiple chains (to differentiate them in the final table) + if volChain: volChain.insert(0,'') - volChain[(vollen - 1)] = leafvol - next = leafvol - for k in range(1, (vollen + 1)): - prev = next - next = volParents[prev] - if next in volParents.keys(): - volChain[(vollen - 1 - k)] = next - else: - if next == BLANK_UUID: - app = 'Template independent' + volChain.insert(0,leafvol) + next = leafvol + while next in volParents.keys(): + prev = next + next = volParents[prev] + if next in volParents.keys(): + volChain.insert(0, next) else: - app = '%s' % (next) + if next == BLANK_UUID: + app = 'Template independent' + else: + app = '%s' % (next) - imageDomVol = '%s:%s:%s' % (sd, image, prev) - templList = self.volumesList[imageDomVol] - if len(templList) == 0: - templList.append(app) + imageDomVol = '%s:%s:%s' % (sd, image, prev) + templList = self.volumesList[imageDomVol] + if len(templList) == 0: + templList.append(app) return volChain @@ -223,10 +227,14 @@ self.tbl['Images'].append([image]) volsToAdd = self.imagesList[imageDom] self.tbl['Volumes'].append(volsToAdd) - vol = volsToAdd[0] - domImageVol = '%s:%s:%s' % (sdUUID, image, vol) - - templToAdd = self.volumesList.get(domImageVol, []) + templToAdd = [] + for vol in volsToAdd: + domImageVol = '%s:%s:%s' % (sdUUID, image, vol) + templ = self.volumesList.get(domImageVol,[]) + if templ: + templToAdd.append(templ[0]) + else: + templToAdd.append('') self.tbl['Template'].append(templToAdd) row += 1 -- To view, visit http://gerrit.ovirt.org/12703 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifa932a47a91caa1a8284ea58678367ca77ed2d9a Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Mark Huth <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
