[libvirt-users] SSH connection timeout

Hi, I am trying to connect to libvirt on KVM host from a remote python client, using the connection string "qemu+ssh://<IP Address>/system" If I setup password less SSH (Public key) between the machines, I am able to proceed with the connection. But If I have not setup the public key authentication, my code hangs trying to connect to libvirt, and there is a prompt for entering password in the shell where the code is running. Is there any way to catch this in an exception and throw an error that public key not setup or password not available? Or is it possible to timeout and abort the request to connect to the host? Whatever timeout variables available online seem to work only for an already active SSH session to timeout. Any pointers ? -- Regards Ananth

On Tue, May 8, 2012 at 8:24 AM, Ananth <cbananth@gmail.com> wrote:
Hi, I am trying to connect to libvirt on KVM host from a remote python client, using the connection string "qemu+ssh://<IP Address>/system" If I setup password less SSH (Public key) between the machines, I am able to proceed with the connection. But If I have not setup the public key authentication, my code hangs trying to connect to libvirt, and there is a prompt for entering password in the shell where the code is running.
Is there any way to catch this in an exception and throw an error that public key not setup or password not available? Or is it possible to timeout and abort the request to connect to the host? Whatever timeout variables available online seem to work only for an already active SSH session to timeout.
Any pointers ?
You'll want to append ?no_tty=1 to the end of your URI that you pass to open() or openReadOnly(). For more info see the docs here: http://libvirt.org/remote.html#Remote_URI_parameters -- Doug Goldstein

Thank you very much Doug. It worked like magic :) Regards Ananth On Tue, May 8, 2012 at 8:06 PM, Doug Goldstein <cardoe@gentoo.org> wrote:
On Tue, May 8, 2012 at 8:24 AM, Ananth <cbananth@gmail.com> wrote:
Hi, I am trying to connect to libvirt on KVM host from a remote python client, using the connection string "qemu+ssh://<IP Address>/system" If I setup password less SSH (Public key) between the machines, I am able to proceed with the connection. But If I have not setup the public key authentication, my code hangs trying to connect to libvirt, and there is a prompt for entering password in the shell where the code is running.
Is there any way to catch this in an exception and throw an error that public key not setup or password not available? Or is it possible to timeout and abort the request to connect to the host? Whatever timeout variables available online seem to work only for an already active SSH session to timeout.
Any pointers ?
You'll want to append ?no_tty=1 to the end of your URI that you pass to open() or openReadOnly().
For more info see the docs here: http://libvirt.org/remote.html#Remote_URI_parameters
-- Doug Goldstein
-- Regards Ananth
participants (2)
-
Ananth
-
Doug Goldstein