Federico Simoncelli has posted comments on this change.

Change subject: gluster: fix no attribute error
......................................................................


Patch Set 2:

(1 comment)

https://gerrit.ovirt.org/#/c/41056/2/vdsm/gluster/storagedev.py
File vdsm/gluster/storagedev.py:

Line 80:     if device.format:
Line 81:         info['uuid'] = device.format.uuid or ''
Line 82:         func = getattr(udev, 'get_device',
Line 83:                        getattr(udev, 'udev_get_device', lambda x: {}))
Line 84:         dev = func(device.sysfsPath) or {}
Here you probably don't need the "or {}" part now.


Anyway I think that it would have been clearer this way:


    if hasattr(udev, 'get_device'):
        dev = udev.get_device(device.sysfsPath)
    elif hasattr(udev, 'udev_get_device'):
        dev = udev.udev_get_device(device.sysfsPath)
    else:
        dev = {}


If you want to be stricter you can use:


    if callable(getattr(udev, 'get_device', None)):
        ...
    ...
Line 85:         info['fsType'] = device.format.type or dev.get('ID_FS_TYPE', 
'')
Line 86:     if hasattr(device.format, 'mountpoint'):
Line 87:         info['mountPoint'] = device.format.mountpoint or ''
Line 88:     return info


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie4ee6f3d62e51c67db12b4859da6508c50e92753
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Timothy Asir <tjeya...@redhat.com>
Gerrit-Reviewer: Bala.FA <barum...@redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com>
Gerrit-Reviewer: Darshan N <dnara...@redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimo...@redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczew...@gmail.com>
Gerrit-Reviewer: Timothy Asir <tjeya...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to