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

Sijo Jose mailtosijojose at gmail.com
Fri Jun 6 07:36:55 UTC 2014


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.


Regards
Sijo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20140606/f03745da/attachment.htm>


More information about the libvirt-users mailing list