Change in vdsm[master]: vm: check operation result for vm nic hotunplug

nsoffer at redhat.com nsoffer at redhat.com
Thu Nov 26 14:23:32 UTC 2015


Nir Soffer has posted comments on this change.

Change subject: vm: check operation result for vm nic hotunplug
......................................................................


Patch Set 9:

(2 comments)

https://gerrit.ovirt.org/#/c/48473/9/vdsm/virt/vmdevices/network.py
File vdsm/virt/vmdevices/network.py:

Line 193:         The path is relative to the root element
Line 194:         """
Line 195:         return "./devices/interface/mac[@address='%s']" % self.macAddr
Line 196: 
Line 197:     def _makeName(self):
> why not just make this a property?
I agree with Francesco, property is better.
Line 198:         name = ''
Line 199:         if hasattr(self, 'type'):
Line 200:             name += self.type + ' '
Line 201:         if hasattr(self, 'macAddr'):


Line 198:         name = ''
Line 199:         if hasattr(self, 'type'):
Line 200:             name += self.type + ' '
Line 201:         if hasattr(self, 'macAddr'):
Line 202:             name += self.macAddr + ' '
This will create these funny names, which probably are not what you want:
- "type mac " instead of "type mac"
- "mac " instead of "mac"
- "type " instead of "type"

The generic solution is:

    parts = (getattr(self, "type", ""), getattr(self, "macAddr", ""))
    return " " .join(p for p in parts if p)


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3d3b2c839cbb4733aecc8d5a0e9a1ae691e14ac3
Gerrit-PatchSet: 9
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki <mmirecki at redhat.com>
Gerrit-Reviewer: Amit Aviram <aaviram at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki <mmirecki at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list