Olaf Hering
2012-Oct-10 15:06 UTC
[Libguestfs] [PATCH] launch: show hint to resolve authentication failure from libvirt
Signed-off-by: Olaf Hering <olaf at aepfle.de> --- Switching from attach-method "appliance" to "libvirt" has surprising side effects, so show a hint how to resolve the "authentication failed" error from libvirt. Patch is not compile tested. src/libvirtdomain.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libvirtdomain.c b/src/libvirtdomain.c index eecea26..110ee86 100644 --- a/src/libvirtdomain.c +++ b/src/libvirtdomain.c @@ -104,6 +104,8 @@ guestfs__add_domain (guestfs_h *g, const char *domain_name, err = virGetLastError (); error (g, _("could not connect to libvirt (code %d, domain %d): %s"), err->code, err->domain, err->message); + if (err->code == VIR_ERR_AUTH_FAILED) + error (g, _("Possible fix: 'polkit-auth --user <username> --grant org.libvirt.unix.manage'")); goto cleanup; } -- 1.7.12.2
Daniel P. Berrange
2012-Oct-10 15:16 UTC
[Libguestfs] [PATCH] launch: show hint to resolve authentication failure from libvirt
On Wed, Oct 10, 2012 at 05:06:37PM +0200, Olaf Hering wrote:> Signed-off-by: Olaf Hering <olaf at aepfle.de> > --- > > Switching from attach-method "appliance" to "libvirt" has surprising > side effects, so show a hint how to resolve the "authentication failed" > error from libvirt. > Patch is not compile tested. > > src/libvirtdomain.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/libvirtdomain.c b/src/libvirtdomain.c > index eecea26..110ee86 100644 > --- a/src/libvirtdomain.c > +++ b/src/libvirtdomain.c > @@ -104,6 +104,8 @@ guestfs__add_domain (guestfs_h *g, const char *domain_name, > err = virGetLastError (); > error (g, _("could not connect to libvirt (code %d, domain %d): %s"), > err->code, err->domain, err->message); > + if (err->code == VIR_ERR_AUTH_FAILED) > + error (g, _("Possible fix: 'polkit-auth --user <username> --grant org.libvirt.unix.manage'"));Hmm, libguestfs is using the qemu://session instance of libvirt, of which one is launched per user. This should not require any authentication at all, since it is only accessible to the current user. PolicyKit is only relevant if connecting to the qemu:///system instance of libvirtd which runs privileged and this is not something libguestfs would be using, unless it was run as root. But if libguestfs ran as root, it would already have permission to connect via policykit. So I'm not really clear why you want this addition 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 :|
Apparently Analagous Threads
- [PATCH] New APIs: Model libvirt authentication events through the API.
- [PATCH 0/2] v2v: -o libvirt: Check if the domain exists on the target (RHBZ#889082).
- libvirt Java to connect at the XEN
- [PATCH v4 0/5] Finish hotplugging support.
- Guest agent is not responding