Change in vdsm[master]: gluster: new vdsm verb glusterHostUUIDGet

danken at redhat.com danken at redhat.com
Thu Jun 27 12:12:24 UTC 2013


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 <avishwan at redhat.com>
Gerrit-Reviewer: Adam Litke <agl at us.ibm.com>
Gerrit-Reviewer: Aravinda VK <avishwan at redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron at redhat.com>
Gerrit-Reviewer: Bala.FA <barumuga at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Giuseppe Vallarelli <gvallare at redhat.com>
Gerrit-Reviewer: Timothy Asir <tjeyasin at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server


More information about the vdsm-patches mailing list