Dan Kenigsberg has posted comments on this change.
Change subject: gluster: new vdsm verb glusterHostUUIDGet
......................................................................
Patch Set 7: I would prefer that you didn't submit this
(3 inline comments)
....................................................
File vdsm/gluster/cli.py
Line 110:
Line 111: def _getGlusterUuid():
Line 112: command = _getGlusterSystemCmd() + ["uuid", "get"]
Line 113: rc, out, err = _execGluster(command)
Line 114: if not rc:
I'm a bit confused. A non-zero rc usually means an error. Here, it Is the
opposite. Is this intentional?
Line 115: try:
Line 116: return dict(["".join(out).split(': ', 1)]).get('UUID', '')
Line 117: except ValueError:
Line 118: # Empty string will be returned in the end so just
Line 112: command = _getGlusterSystemCmd() + ["uuid", "get"]
Line 113: rc, out, err = _execGluster(command)
Line 114: if not rc:
Line 115: try:
Line 116: return dict(["".join(out).split(': ', 1)]).get('UUID', '')
I find the following much more readable.
for line in out:
if line.startswith('UUID: '):
return line[6:]
else:
handle error
Line 117: except ValueError:
Line 118: # Empty string will be returned in the end so just
Line 119: # ignore the ValueError here
Line 120: pass
Line 118: # Empty string will be returned in the end so just
Line 119: # ignore the ValueError here
Line 120: pass
Line 121:
Line 122: return ''
The empty string does not look like a valid UUID. Do we really want to return
it on error? Why not return a proper error code?
I what occasions do we expect not returning a UUID?
Line 123:
Line 124:
Line 125: def _parseVolumeStatus(tree):
Line 126: status = {'name':
tree.find('volStatus/volumes/volume/volName').text,
--
To view, visit http://gerrit.ovirt.org/13785
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Idf48b4c9530c48b2c46234d98c8cb4244adf22fd
Gerrit-PatchSet: 7
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Aravinda VK <[email protected]>
Gerrit-Reviewer: Adam Litke <[email protected]>
Gerrit-Reviewer: Aravinda VK <[email protected]>
Gerrit-Reviewer: Ayal Baron <[email protected]>
Gerrit-Reviewer: Bala.FA <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Giuseppe Vallarelli <[email protected]>
Gerrit-Reviewer: Timothy Asir <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches