Change in vdsm[master]: Live Merge: Update path using libvirt supplied value

alitke at redhat.com alitke at redhat.com
Thu Aug 21 13:25:05 UTC 2014


Adam Litke has posted comments on this change.

Change subject: Live Merge: Update path using libvirt supplied value
......................................................................


Patch Set 6:

(2 comments)

http://gerrit.ovirt.org/#/c/31365/6/vdsm/virt/vm.py
File vdsm/virt/vm.py:

Line 5529:             if not sourceXML:
Line 5530:                 break
Line 5531:             sourceAttr = ('file', 'dev')[drive.blockDev]
Line 5532:             path = sourceXML.getAttribute(sourceAttr)
Line 5533:             entry = VolumeChainEntry(pathToVolID(drive, path), path)
> It would be little nicer to do:
Sure.  It seems that fromani was encouraging me to cut down on intermediate variables so I changed it to work this way in a previous iteration.
Line 5534:             volChain.insert(0, entry)
Line 5535:             bsXML = findElement(diskXML, 'backingStore')
Line 5536:             if not bsXML:
Line 5537:                 break


Line 5585: 
Line 5586:         # Remove any components of the volumeChain which are no longer present
Line 5587:         newChain = [x for x in device['volumeChain']
Line 5588:                     if x['volumeID'] in volumes]
Line 5589:         device['volumeChain'] = drive.volumeChain = newChain
> Can we simplify this code by using data in chain to overwrite data in devic
Not really, because each element of device['volumeChain'] is a dictionary and there is more information in there than we can reasonably track (or would want to rediscover.  Since Live Merge only deletes an entry from the chain it is much easier to do it this way in my opinion.
Line 5590: 
Line 5591:     def handleBlockJobEvent(self, jobID, drive, mode):
Line 5592:         if mode == 'finished':
Line 5593:             self.log.info("Live merge job completed (job %s)", jobID)


-- 
To view, visit http://gerrit.ovirt.org/31365
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie341333ad934645c0fe4f2fd31733c459d306d9a
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list