Change in vdsm[master]: supervdsm_udev: generalize rule searching
nsoffer at redhat.com
nsoffer at redhat.com
Thu Mar 24 12:28:04 UTC 2016
Nir Soffer has posted comments on this change.
Change subject: supervdsm_udev: generalize rule searching
......................................................................
Patch Set 3: Code-Review-1
(5 comments)
https://gerrit.ovirt.org/#/c/55193/3/vdsm/supervdsm_api/udev.py
File vdsm/supervdsm_api/udev.py:
Line 71
Line 72
Line 73
Line 74
Line 75
This looks like a reimplementation of the glob module. Lets use it instead.
Wouldn't this work?
pattern = _UDEV_RULE_FILE_PREFIX + "*-" + thiefId + _UDEV_RULE_FILE_EXT
for path in glob.glob(pattern):
...
A clear problem with this code is the too long constants, this is the udev
module, so we can shorten all the constants like this:
RULE_PREFIX + "*-" + thiefId + RULE_EXT
Anyway, we don't need a helper for this, we don't use this logic elsewhere.
Line 87
Line 88
Line 89
Line 90
Line 91
These constants are ugly, a helper to create rule paths will be better.
Line 93
Line 94
Line 95
Line 96
Line 97
This should use one parameter per line and kwargs parameters:
KERNEL=="{kernel}", ...
Line 111
Line 112
Line 113
Line 114
Line 115
If you like to refactor, we need a helper for this ugly code repeated everywhere.
Line 145: _udevTrigger(attr_matches=(('busnum', int(bus)),
Line 146: ('devnum', int(device))))
Line 147:
Line 148:
Line 149: def _rgrep(identifying_pattern):
We should ue glob instead in the only calller.
Line 150: """
Line 151: Search for rules generated by VDSM containing specific pattern.
Line 152:
Line 153: Arguments:
--
To view, visit https://gerrit.ovirt.org/55193
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I5165d7e12f12d512cbc6455fd7edf9a5303530cb
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik <mpolednik at redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzamazal 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