Nir Soffer has posted comments on this change.
Change subject: hostdev: add udev rules for USB devices ......................................................................
Patch Set 3: Code-Review-1
(1 comment)
https://gerrit.ovirt.org/#/c/44679/3/vdsm/supervdsmServer File vdsm/supervdsmServer:
Line 296: raise OSError(errno.EINVAL, "Could not trigger change for device \ Line 297: %s, out %s\nerr %s" % (guid, out, err)) Line 298: Line 299: @logDecorator Line 300: def udevTriggerUSB(self, bus, device): We should not have such apis.
We should change the udevTrigger api to be more generic, accepting the required options that "udevadm trigger" accepts, so different code can use the same api to trigger events.
For example, the guid parameter to udevTrigger does not make sense, and should be replaced with the proper generic option like:
def udevTrigger(self, properties_match=()): ...
To trigger a device with guid, the caller should do:
udevTrigger(properties_match=["DM_NAME=xxxyyy"])
Which will generate this command line option:
--property-match="DM_NAME=xxxyyy" Line 301: self.__udevReloadRules('usb_' + '_'.join((bus, device))) Line 302: cmd = [EXT_UDEVADM, 'trigger', '--verbose', '--action', 'change', Line 303: '--attr-match=busnum={}'.format(bus), Line 304: '--attr-match=devnum={}'.format(device)]