[libvirt-users] Libvirt Python Bindings - Remote Connection using openAuth.

Martin Kletzander mkletzan at redhat.com
Fri Jun 6 10:51:19 UTC 2014


On Fri, Jun 06, 2014 at 03:11:42PM +0530, Sijo Jose wrote:
>Martin,
>
>What do you mean by libvirt credentials...?
>

Look at /etc/libvirt/libvirtd.conf, configuration options that start
with "auth_".  Also have a look at http://libvirt.org/auth.html where
the configuration is explained.

Martin

>
>
>-Sijo
>
>
>
>On Fri, Jun 6, 2014 at 1:57 PM, Martin Kletzander <mkletzan at redhat.com>
>wrote:
>
>> On Fri, Jun 06, 2014 at 01:06:55PM +0530, Sijo Jose wrote:
>>
>>> Hi,
>>> I am using libvirt with python binding, and I want to connect to a remote
>>> host.
>>> I was able to connect after making ssh certificate, but It is not
>>> applicable for my project.
>>> So I want to use openAuth() method, but I could not succeed connecting to
>>> a
>>> remote host using it.
>>>
>>> Here is my code
>>> ------------------------
>>>
>>> import libvirt
>>>
>>>
>>> USER = "root"
>>> PASS = "mypasswd"
>>>
>>> def authcb(credentials, user_data):
>>>    for credential in credentials:
>>>        if credential[0] == libvirt.VIR_CRED_AUTHNAME:
>>>            credential[4] = USER
>>>        elif credential[0] == libvirt.VIR_CRED_PASSPHRASE:
>>>            credential[4] = PASS
>>>    return 0
>>>
>>> auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE], authcb,
>>> None]
>>> conn = libvirt.openAuth("qemu+ssh://192.168.1.21/system", auth, 0)
>>>
>>> print conn.getHostname()
>>> -------------------------------
>>> *If there is something wrong, how am I supposed to use it.*
>>>
>>>
>>> If its not the right place to get libvirt-python related help, from
>>> where can I get it.
>>>
>>>
>> What's the error you see?  Those root:mypasswd are credentials for
>> libvirt and *not* ssh, beware of that.
>>
>> Martin
>>
>>
>>> Regards
>>> Sijo
>>>
>>
>>  _______________________________________________
>>> libvirt-users mailing list
>>> libvirt-users at redhat.com
>>> https://www.redhat.com/mailman/listinfo/libvirt-users
>>>
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20140606/5d8e11a3/attachment.sig>


More information about the libvirt-users mailing list