Francesco Romani has posted comments on this change. Change subject: hostdev: add dynamic udev rule creation for iommu groups ......................................................................
Patch Set 5: (4 comments) thanks for the improvements, looks nicer. There are a couple of minor mistakes, hence -1. About creating udev rules on the fly, this still scares me, but I acknowledge the rationale and unfortunately I don't have better approaches to suggest at the moment. http://gerrit.ovirt.org/#/c/36268/5/vdsm/hostdev.py File vdsm/hostdev.py: Line 129: for device in libvirtconnection.get().listAllDevices(0)) Line 130: Line 131: Line 132: def _device_routine_internal(libvirt_device, device_params, action): Line 133: functions_template = namedtuple('functions_tempalte', ['libvirt', 'udev']) typo (tempalte) Moreover, placing this line here means that namedtuple is created (with eval()!) each time the function is called. Better to move it on the module. Line 134: function_mapping = \ Line 135: {_DETACH: functions_template(partial(libvirt_device.detachFlags, Line 136: driverName=None), Line 137: supervdsm.getProxy(). Line 130: Line 131: Line 132: def _device_routine_internal(libvirt_device, device_params, action): Line 133: functions_template = namedtuple('functions_tempalte', ['libvirt', 'udev']) Line 134: function_mapping = \ You can get rid of this \ if you move the opening bracket just here: function_mapping = { Line 135: {_DETACH: functions_template(partial(libvirt_device.detachFlags, Line 136: driverName=None), Line 137: supervdsm.getProxy(). Line 138: vfioAppropriateDevice), Line 135: {_DETACH: functions_template(partial(libvirt_device.detachFlags, Line 136: driverName=None), Line 137: supervdsm.getProxy(). Line 138: vfioAppropriateDevice), Line 139: _REATTACH: functions_template(partial(libvirt_device.reAttach), Do you need this partial with only one argument? Line 140: supervdsm.getProxy(). Line 141: vfioRmAppropriateDevices)} Line 142: Line 143: iommu_group = device_params['iommu_group'] Line 142: Line 143: iommu_group = device_params['iommu_group'] Line 144: Line 145: if device_params['capability'] in _DETACH_REQUIRING_UDEV: Line 146: function_mapping[action].udev(iommu_group) IMHO nicer and clearer Line 147: supervdsm.getProxy().udevTrigger(iommu_group) Line 148: Line 149: if device_params['capability'] in _DETACH_REQUIRING_CAPS: Line 150: function_mapping[action].libvirt() -- To view, visit http://gerrit.ovirt.org/36268 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ieac8d58e01d7277e535a2101d522961816ea88eb Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Martin Polednik <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Francesco Romani <[email protected]> Gerrit-Reviewer: Martin Polednik <[email protected]> Gerrit-Reviewer: Michal Skrivanek <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
