Francesco Romani has posted comments on this change.
Change subject: virt: Resolve snapshot type after prepareVolumePath
......................................................................
Patch Set 2:
(1 comment)
http://gerrit.ovirt.org/#/c/32066/2/vdsm/virt/vm.py
File vdsm/virt/vm.py:
Line 3979: newDrives[vmDevName]["format"] = "cow"
Line 3980:
Line 3981: # We cannot evaluate blockDev until after prepareVolumePath
Line 3982: snapTypes[vmDevName] = \
Line 3983: lambda: 'block' if vmDrive.blockDev else
'file'
I'm missing something.
To make things more explicit. I
think is clearer if we add another dictionary/cache which maps vmDevName - which we'll
have down on line 4007 when we need this value to the relevant vmDrive:
drives[vmDevName] = vmDrive
So in line 4007 we can just write
snapelem = _diskSnapshot(vmDevName,
newDrives[vmDevName]["path"],
"block" if drives[vmDevName].blockDev else
"file")
I think this is a bit better than juggling with lambdas.
What do you think?
Line 3984:
Line 3985: # If all the drives are the current ones, return success
Line 3986: if len(newDrives) == 0:
Line 3987: self.log.debug('all the drives are already in use,
success')
--
To view, visit
http://gerrit.ovirt.org/32066
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia4726702eb329bf65f1f9c658067f7a01c2179e4
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
Gerrit-Reviewer: Adam Litke <alitke(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes