Martin Polednik has uploaded a new change for review. Change subject: explain more (udev) ......................................................................
explain more (udev) Change-Id: Ieac8d58e01d7277e535a2101d522961816ea88eb Signed-off-by: Martin Polednik <[email protected]> --- M vdsm/hostdev.py M vdsm/supervdsmServer 2 files changed, 20 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/36268/1 diff --git a/vdsm/hostdev.py b/vdsm/hostdev.py index 3b5ed7c..a74cb44 100644 --- a/vdsm/hostdev.py +++ b/vdsm/hostdev.py @@ -21,9 +21,11 @@ import xml.etree.ElementTree as etree from vdsm import libvirtconnection +import supervdsm _DETACH_REQUIRING_CAPS = ('usb_device', 'pci') +_DETACH_REQUIRING_UDEV = ('pci') def _name_to_pci_path(device_name): @@ -135,6 +137,9 @@ def detach_detachable(device_name): libvirt_device, device_params = _get_device_ref_and_params(device_name) + if device_params['capability'] in _DETACH_REQUIRING_UDEV: + supervdsm.getProxy().appropriateVfioDevice( + device_params['iommu_group']) if device_params['capability'] in _DETACH_REQUIRING_CAPS: libvirt_device.detachFlags(None) @@ -146,3 +151,6 @@ if device_params['capability'] in _DETACH_REQUIRING_CAPS: libvirt_device.reAttach() + + if device_params['capability'] in _DETACH_REQUIRING_UDEV: + pass diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer index b1e8603..f699925 100755 --- a/vdsm/supervdsmServer +++ b/vdsm/supervdsmServer @@ -69,7 +69,8 @@ from storage.fileUtils import chown, resolveGid, resolveUid from storage.fileUtils import validateAccess as _validateAccess from vdsm.constants import METADATA_GROUP, EXT_CHOWN, EXT_UDEVADM, \ - DISKIMAGE_USER, DISKIMAGE_GROUP, P_LIBVIRT_VMCHANNELS, VDSM_USER + DISKIMAGE_USER, DISKIMAGE_GROUP, P_LIBVIRT_VMCHANNELS, VDSM_USER, \ + QEMU_PROCESS_USER, QEMU_PROCESS_GROUP from storage.devicemapper import _removeMapping, _getPathsStatus from vdsm.config import config import mkimage @@ -279,6 +280,16 @@ rf.write(rule) @logDecorator + def appropriateVfioDevice(self, iommu_group): + ruleFile = _UDEV_RULE_FILE_NAME % (iommu_group, iommu_group) + rule = 'KERNEL=="{}", SUBSYSTEM=="vfio" RUN+="{} {}:{} ' + ' /dev/vfio/{}"'.format(iommu_group, EXT_CHOWN, QEMU_PROCESS_USER, + QEMU_PROCESS_GROUP, iommu_group) + with open(ruleFile, "w") as rf: + self.log.debug("Creating rule %s: %r", ruleFile, rule) + rf.write(rule) + + @logDecorator def rmAppropriateRules(self, thiefId): re_apprDevRule = "^" + _UDEV_RULE_FILE_PREFIX + ".*?-" + thiefId + \ _UDEV_RULE_FILE_EXT + "$" -- To view, visit http://gerrit.ovirt.org/36268 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ieac8d58e01d7277e535a2101d522961816ea88eb 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
