Change in vdsm[master]: hostdev: change ownership for passthrough USB devices
mpolednik at redhat.com
mpolednik at redhat.com
Wed Sep 16 14:43:59 UTC 2015
Martin Polednik has posted comments on this change.
Change subject: hostdev: change ownership for passthrough USB devices
......................................................................
Patch Set 14:
(3 comments)
https://gerrit.ovirt.org/#/c/44679/14/vdsm/supervdsmServer
File vdsm/supervdsmServer:
Line 398: @logDecorator
Line 399: def appropriateUSBDevice(self, bus, device):
Line 400: rule_file = _UDEV_RULE_FILE_NAME_USB % (bus, device)
Line 401: rule = ('SUBSYSTEM=="usb", ATTRS{{busnum}}=="{}", '
Line 402: 'ATTRS{{devnum}}=="{}", OWNER="{}", GROUP="{}"\n').format(
> You should use final rules OWNER:="{}", GROUP:="{}". Otherwise, somebody el
Done.
Awesome thing.
Line 403: bus, device, QEMU_PROCESS_USER, QEMU_PROCESS_GROUP)
Line 404:
Line 405: with open(rule_file, "w") as rf:
Line 406: self.log.debug("Creating rule %s: %r", rule_file, rule)
Line 421:
Line 422: self.log.debug('Changing ownership (to root:root) of device '
Line 423: 'bus: %s, device:: %s',
Line 424: bus, device, QEMU_PROCESS_USER, QEMU_PROCESS_GROUP)
Line 425: udev_path = _USB_UDEV_PATH % (int(bus), int(device))
> udev_path? Isn't it the device path?
well it is path to the device in the udev subsystem... No real preference, can go with device_path.
Line 426: cmd = [EXT_CHOWN, '%s:%s' % ('root', 'root'), udev_path]
Line 427: rc, out, err = utils.execCmd(cmd)
Line 428: if err:
Line 429: raise OSError(errno.EINVAL, 'Could not change ownership'
Line 422: self.log.debug('Changing ownership (to root:root) of device '
Line 423: 'bus: %s, device:: %s',
Line 424: bus, device, QEMU_PROCESS_USER, QEMU_PROCESS_GROUP)
Line 425: udev_path = _USB_UDEV_PATH % (int(bus), int(device))
Line 426: cmd = [EXT_CHOWN, '%s:%s' % ('root', 'root'), udev_path]
> Why format root when you can simply use: "root:root"?
Brain lag. Done.
Line 427: rc, out, err = utils.execCmd(cmd)
Line 428: if err:
Line 429: raise OSError(errno.EINVAL, 'Could not change ownership'
Line 430: 'out %s\nerr %s' % (out, err))
--
To view, visit https://gerrit.ovirt.org/44679
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I1f72f63186187254cd4aded0a2e6c396001ca28b
Gerrit-PatchSet: 14
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: Michal Skrivanek <michal.skrivanek at redhat.com>
Gerrit-Reviewer: Michal Skrivanek <mskrivan at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list