Change in vdsm[master]: virt: graphics: avoid None in specParams

mpolednik at redhat.com mpolednik at redhat.com
Thu Sep 24 10:21:53 UTC 2015


Martin Polednik has posted comments on this change.

Change subject: virt: graphics: avoid None in specParams
......................................................................


Patch Set 2: Code-Review-1

(1 comment)

https://gerrit.ovirt.org/#/c/46629/2/vdsm/virt/vmdevices/graphics.py
File vdsm/virt/vmdevices/graphics.py:

Line 60:         # It's possible that the network is specified vm's conf
Line 61:         # and not in specParams. This is considered legacy.
Line 62:         confDisplayNetwork = conf.get('displayNetwork')
Line 63:         if not self.specParams.get('displayNetwork') and confDisplayNetwork:
Line 64:             self.specParams['displayNetwork'] = confDisplayNetwork
Although probably fine, it's a bit harder to read - I kind of like the 'or' approach more. What about using something like

displayNetwork = self.specParams.get('displayNetwork') or conf.get('displayNetwork')
if displayNetwork:
        self.specParams['displayNetwork'] = displayNetwork

Unless I'm missing something, the behavior is the same but future readers don't have to deal with nand :)
Line 65: 
Line 66:         self.specParams['displayIp'] = (
Line 67:             _getNetworkIp(self.specParams.get('displayNetwork')))
Line 68: 


-- 
To view, visit https://gerrit.ovirt.org/46629
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2a651c18c02c207f5497f22f0aad3d2967efd9a4
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik <mpolednik at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list