Change in vdsm[master]: gluster: fix size conversion issues in brick create
rnachimu at redhat.com
rnachimu at redhat.com
Mon Dec 21 04:45:17 UTC 2015
Ramesh N has posted comments on this change.
Change subject: gluster: fix size conversion issues in brick create
......................................................................
Patch Set 6:
(5 comments)
Thanks for your suggestions Nir. I will fix them in the next patch set.
https://gerrit.ovirt.org/#/c/50705/6/vdsm/gluster/storagedev.py
File vdsm/gluster/storagedev.py:
Line 65:
Line 66: # This method helps to convert the size to given Unittype.
Line 67: # This is required to since there a incompatible change in blivet API
Line 68: # size.convertTo where older versions required string param but newer versions
Line 69: # requires the constants in blivet.size.KiB.
> blivet.size.KiB -> blivet.size.
Done
Line 70: def _getDeviceSize(device, unitType='MiB'):
Line 71: if hasattr(blivet.size, 'MiB'):
Line 72: if unitType == 'KiB':
Line 73: return device.size.convertTo(blivet.size.KiB)
Line 66: # This method helps to convert the size to given Unittype.
Line 67: # This is required to since there a incompatible change in blivet API
Line 68: # size.convertTo where older versions required string param but newer versions
Line 69: # requires the constants in blivet.size.KiB.
Line 70: def _getDeviceSize(device, unitType='MiB'):
> Add a note that this part is for the new blivet version.
Done
Line 71: if hasattr(blivet.size, 'MiB'):
Line 72: if unitType == 'KiB':
Line 73: return device.size.convertTo(blivet.size.KiB)
Line 74: elif unitType == 'MiB':
Line 71: if hasattr(blivet.size, 'MiB'):
Line 72: if unitType == 'KiB':
Line 73: return device.size.convertTo(blivet.size.KiB)
Line 74: elif unitType == 'MiB':
Line 75: return device.size.convertTo(blivet.size.MiB)
> This should raise, the caller provided unitType we don't know how to handle
Done
Line 76: else:
Line 77: return device.size.convertTo(spec=unitType)
Line 78: return 0
Line 79:
Line 72: if unitType == 'KiB':
Line 73: return device.size.convertTo(blivet.size.KiB)
Line 74: elif unitType == 'MiB':
Line 75: return device.size.convertTo(blivet.size.MiB)
Line 76: else:
> Add a note that this is for old blivet version supporting spec string.
Done
Line 77: return device.size.convertTo(spec=unitType)
Line 78: return 0
Line 79:
Line 80:
Line 74: elif unitType == 'MiB':
Line 75: return device.size.convertTo(blivet.size.MiB)
Line 76: else:
Line 77: return device.size.convertTo(spec=unitType)
Line 78: return 0
> Not needed, and a bad way to fail, now all the callers have to check for 0,
Done
Line 79:
Line 80:
Line 81: def _getDeviceDict(device, createBrick=False):
Line 82: info = {'name': device.name,
--
To view, visit https://gerrit.ovirt.org/50705
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I576b1a8c880ef6f355157225c7b763378d8cf46d
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ramesh N <rnachimu at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Ramesh N <rnachimu at redhat.com>
Gerrit-Reviewer: Sahina Bose <sabose at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list