On Sat, Jul 21, 2012 at 08:20:49PM +0100, Richard W.M. Jones wrote:
+
+ /* Connect to libvirt, get capabilities. */
+ /* XXX Support libvirt authentication in the future. */
+ conn = virConnectOpen (libvirt_uri);
+ if (!conn) {
+ error (g, _("could not connect to libvirt: URI: %s"),
+ libvirt_uri ? : "NULL");
+ goto cleanup;
+ }
Authentication is a tricky one. If your STDIN is a tty, then
you could use OpenAuth() passing in virConnectAuthPtrDefault,
to get the default text-mode auth prompt.
If you are running in a GUI app though, there needs to be
some way to graphically collect credentials, which means
libguestfs would probably need to expose a callback API
kinda like the libvirt auth callbacks.
Alternatively you could just say to hell with it, and require
the application to pass in a pre-opened virConnectPtr that
you use. This is actually quite desirable, since it will avoid
the user having to authenticate multiple times, when the app
already has an open connection
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 :|