Martin Polednik has uploaded a new change for review. Change subject: supervdsm: only trigger 'vfio' subsystem for VFIO devices ......................................................................
supervdsm: only trigger 'vfio' subsystem for VFIO devices In order to avoid triggering of all events we need to use specialized variant of udevTrigger. This patch extends trigger function to add ability to trigger specific subsystems and makes use of it in method udevTriggerVFIO. This avoids refreshing everything, possibly eliminating way of triggering everything via host devices subsystem. Change-Id: Icb4fecbe5108a6ff7d695887e6e60df36e4874d7 Signed-off-by: Martin Polednik <[email protected]> --- M lib/vdsm/udevadm.py M vdsm/supervdsmServer 2 files changed, 21 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/45345/1 diff --git a/lib/vdsm/udevadm.py b/lib/vdsm/udevadm.py index 24327d3..f976fc4 100644 --- a/lib/vdsm/udevadm.py +++ b/lib/vdsm/udevadm.py @@ -61,7 +61,7 @@ logging.error("%s", e) -def trigger(attr_matches=(), property_matches=()): +def trigger(attr_matches=(), property_matches=(), subsystem_matches=()): ''' Request device events from the kernel. @@ -84,6 +84,13 @@ and causes only events from devices that match given property to be triggered. + + subsystem_matches Expects tuple of subsystems. + + ('a', 'b') ~> --subsystem-match=a --subsystem-match=b + + Causes only events related to specified subsystem to + be triggered. ''' _run_command(['control', '--reload']) @@ -95,6 +102,9 @@ for name, value in attr_matches: cmd.append('--attr-match={}={}'.format(name, value)) + for name in subsystem_matches: + cmd.append('--subsystem-match={}'.format(name)) + _run_command(cmd) diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer index e97b092..9473aa2 100755 --- a/vdsm/supervdsmServer +++ b/vdsm/supervdsmServer @@ -303,6 +303,14 @@ 'out %s\nerr %s' % (e.out, e.err)) @logDecorator + def udevTriggerVFIO(self): + try: + udevadm.trigger(subsystem_matches=('vfio',)) + except udevadm.Error as e: + raise OSError(errno.EINVAL, 'Could not trigger change ' + 'out %s\nerr %s' % (e.out, e.err)) + + @logDecorator def appropriateDevice(self, guid, thiefId): ruleFile = _UDEV_RULE_FILE_NAME % (guid, thiefId) # WARNING: we cannot use USER, GROUP and MODE since using any of them @@ -355,7 +363,7 @@ self.log.debug("Creating rule %s: %r", rule_file, rule) rf.write(rule) - udevadm.trigger() + self.udevTriggerVFIO() @logDecorator def rmAppropriateIommuGroup(self, iommu_group): @@ -382,7 +390,7 @@ self.log.debug("Removing rule %s", rule_file) if not error: - udevadm.trigger() + self.udevTriggerVFIO() @logDecorator def appropriateUSBDevice(self, bus, device): -- To view, visit https://gerrit.ovirt.org/45345 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icb4fecbe5108a6ff7d695887e6e60df36e4874d7 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Martin Polednik <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
