Sijo Jose
2014-Jun-06 07:36 UTC
[libvirt-users] Libvirt Python Bindings - Remote Connection using openAuth.
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
Martin Kletzander
2014-Jun-06 08:27 UTC
Re: [libvirt-users] Libvirt Python Bindings - Remote Connection using openAuth.
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@redhat.com >https://www.redhat.com/mailman/listinfo/libvirt-users
Sijo Jose
2014-Jun-06 09:41 UTC
Re: [libvirt-users] Libvirt Python Bindings - Remote Connection using openAuth.
Martin, What do you mean by libvirt credentials...? -Sijo On Fri, Jun 6, 2014 at 1:57 PM, Martin Kletzander <mkletzan@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@redhat.com >> https://www.redhat.com/mailman/listinfo/libvirt-users >> >