[libvirt-users] [Libvirt Users]how to provide password authentication for qemu driver
Daniel P. Berrange
berrange at redhat.com
Mon Apr 27 12:48:36 UTC 2015
On Mon, Apr 27, 2015 at 05:13:36AM -0700, Dhaval_Shah1 at dell.com wrote:
> Dell Customer Communication
> Hi All,
>
> I am using
>
> Compiled against library: libvirt 1.2.9
> Using library: libvirt 1.2.9
> Using API: QEMU 1.2.9
> Running hypervisor: QEMU 2.1.2
>
> I want user to provide username and password authentication to virConnectPtr
> virConnectOpenAuth(const char *name,
> virConnectAuthPtr auth,
> unsigned int flags) to login remotely for the qemu hypervisor.
>
> But it is not taking user provided username and driver. Because
> internally it is calling below qemu driver function,
>
> static virDrvOpenStatus qemuConnectOpen(virConnectPtr conn,
> virConnectAuthPtr auth ATTRIBUTE_UNUSED,
> unsigned int flags)
>
> so it is not taking any user provided auth parameters and it is internally
> calling separate function for prompting password. I don't want to provide
> password here.
> In case of windows HyperV it is working fine as it takes auth parameters
> but for Qemu Hypervisor I am facing this issue since here the auth
> parameters as marked as ATTRIBUTE_UNUSED.
Actually your intepretation of the callpath is not quite right. The
virConnectOpenAuth() method in libvirt.so will end up calling
the remoteConnectOpen() method in src/remote/remote_driver.c.
This opens an RPC connection to libvirtd, performs authentication,
and then calls qemuConnectOpen(). So from that sequence it is the
remoteConnectOpen() method that deals with passwords/usernames,
not qemuConnectOpen().
If you want to get an idea how to provide username/password via the
callback, take a look at the virConnectAuthCallbackDefault() method
in src/libvirt.c which is the default impl that just prompts on the
terminal console.
Regards,
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 libvirt-users
mailing list