[libvirt] [PATCH] udev: fix regression with qemu:///session
Daniel P. Berrange
berrange at redhat.com
Mon Mar 21 16:34:21 UTC 2011
On Wed, Mar 16, 2011 at 03:48:52PM -0600, Eric Blake wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=684655 points out
> a regression introduced in commit 2215050edd - non-root users
> can't connect to qemu:///session because libvirtd dies when
> it can't use pciaccess initialization.
>
> * src/node_device/node_device_udev.c (udevDeviceMonitorStartup):
> Don't abort udev driver (and libvirtd overall) if non-root user
> can't use pciaccess.
> ---
> src/node_device/node_device_udev.c | 19 ++++++++++++-------
> 1 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
> index be6a371..44df16e 100644
> --- a/src/node_device/node_device_udev.c
> +++ b/src/node_device/node_device_udev.c
> @@ -1,7 +1,7 @@
> /*
> * node_device_udev.c: node device enumeration - libudev implementation
> *
> - * Copyright (C) 2009-2010 Red Hat, Inc.
> + * Copyright (C) 2009-2011 Red Hat, Inc.
> *
> * This library is free software; you can redistribute it and/or
> * modify it under the terms of the GNU Lesser General Public
> @@ -1589,7 +1589,7 @@ out:
> return ret;
> }
>
> -static int udevDeviceMonitorStartup(int privileged ATTRIBUTE_UNUSED)
> +static int udevDeviceMonitorStartup(int privileged)
> {
> udevPrivate *priv = NULL;
> struct udev *udev = NULL;
> @@ -1597,11 +1597,16 @@ static int udevDeviceMonitorStartup(int privileged ATTRIBUTE_UNUSED)
> int pciret;
>
> if ((pciret = pci_system_init()) != 0) {
> - char ebuf[256];
> - VIR_ERROR(_("Failed to initialize libpciaccess: %s"),
> - virStrerror(pciret, ebuf, sizeof ebuf));
> - ret = -1;
> - goto out;
> + /* Ignore failure as non-root; udev is not as helpful in that
> + * situation, but a non-privileged user won't benefit much
> + * from udev in the first place. */
> + if (privileged || errno != EACCES) {
> + char ebuf[256];
> + VIR_ERROR(_("Failed to initialize libpciaccess: %s"),
> + virStrerror(pciret, ebuf, sizeof ebuf));
> + ret = -1;
> + goto out;
> + }
> }
>
> if (VIR_ALLOC(priv) < 0) {
ACK, though it works fine without this on Fedora 14 hosts.
So I guess its only older libpciaccess that has trouble
as non-root
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list