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

Sijo Jose mailtosijojose at gmail.com
Fri Jun 6 09:41:42 UTC 2014


Martin,

What do you mean by libvirt credentials...?



-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 --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20140606/fec5c142/attachment.htm>


More information about the libvirt-users mailing list