<Dhaval_Shah1@dell.com>
2015-Apr-27 12:13 UTC
[libvirt-users] [Libvirt Users]how to provide password authentication for qemu driver
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. Can anyone help me with this that how can I achieve this? Thanks & Regards, Dhaval Shah
Daniel P. Berrange
2015-Apr-27 12:48 UTC
Re: [libvirt-users] [Libvirt Users]how to provide password authentication for qemu driver
On Mon, Apr 27, 2015 at 05:13:36AM -0700, Dhaval_Shah1@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 :|
<Dhaval_Shah1@dell.com>
2015-May-05 09:44 UTC
Re: [libvirt-users] [Libvirt Users]how to provide password authentication for qemu driver
Dell Customer Communication Hi denial, Thanks for explaining the codeflow which takes care of user name and password. I have gone through the function of virConnectAuthCallbackDefault(). Here this function asks user to provide password. Where as in my application I don't want and prompt. I want to provide this user name and password first time after that I don't want any prompt for password. I wanted to understand that when I am using a function virConnectOpenAuth and providing my own callback to retrieve the username and password then why it doesn't work for qemu hypervisor. Do I need to change any settings in libvirtd.conf file to make this happen? Thanks & Regards, Dhaval Shah -----Original Message----- From: Daniel P. Berrange [mailto:berrange@redhat.com] Sent: Monday, April 27, 2015 6:19 PM To: Shah1, Dhaval Cc: libvirt-users@redhat.com Subject: Re: [libvirt-users] [Libvirt Users]how to provide password authentication for qemu driver On Mon, Apr 27, 2015 at 05:13:36AM -0700, Dhaval_Shah1@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 :|
Reasonably Related Threads
- Re: [Libvirt Users]how to provide password authentication for qemu driver
- [PATCH] libvirt-auth: Provide a friendlier wrapper around virConnectAuthPtrDefault (RHBZ#1044014).
- daemon/ warnings
- [LLVMdev] Re: Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM
- [LLVMdev] Re: Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM