Donald Plummer wrote:
I'm trying to get the ruby-libvirt bindings working. I've
installed
them from the gem (ruby-libvirt-0.0.7.gem), but I'm having trouble. My
setup is:
Client: Debian Lenny, libvirt 0.4.4 compilied with Xen API 3.0.1 support
Server: CentOS 5.2, libvirt 0.3.3 compilied with Xen API 3.0.1
(running Xen 3.1.0)
The virsh command will connect from the client to the server using
xen+ssh, but not the default TLS. The error I get when trying to use
TLS is:
dplummer@vps-manager:~$ virsh -c xen://lvh2/
libvir: Remote error : No route to host
error: failed to connect to the hypervisor
I've setup certs on both the client and the server, there are no
firewalls between them, and I can ping between them just fine.
Anyway, what I'm really trying to do is get the ruby bindings working,
and since the xen+ssh virsh connection works, I'm trying that. But
getting the error "socket closed unexpectedly".
--------------------
dplummer@vps-manager:~$ irb
irb(main):001:0> require 'libvirt'
=> true
irb(main):002:0> system('virsh -c xen+ssh://root@lvh2/ version')
Compiled against library: libvir 0.4.4
Using library: libvir 0.4.4
Using API: Xen 3.0.1
Running hypervisor: Xen 3.1.0
=> true
irb(main):003:0> conn = Libvirt::open('xen+ssh://root@lvh2/')
libvir: Remote error : socket closed unexpectedly
Libvirt::ConnectionError: Failed to open xen+ssh://root@lvh2
from (irb):3:in `open'
from (irb):3
from :0
irb(main):004:0>
--------------------
Anyone have any suggestions? Anyone get this to work? Thanks!
It sounds like you have two different problems here: one is that you can't get
the TLS stuff working, and the second is that you can't get the ssh stuff
working. Neither seem particular to the ruby-libvirt bindings, so leave them
out for the moment; just do everything on the command-line.
I'll start with the TLS stuff:
1) Did you follow all of the instructions on
http://libvirt.org/remote.html to
begin with?
2) You say you have certs setup, which is good, but the command you are using:
dplummer@vps-manager:~$ virsh -c xen://lvh2/
Isn't going to work for two reasons. The first is that you didn't specify a
command; you'll want to add at least "list" on the end there. The more
important reason is that if you are using TLS, you need a connection string like
xen+tls://lvh2 (assuming the certificates are setup properly). If this still
fails, you can run the command with LIBVIRT_DEBUG=1 on the front to get some
additional debugging information.
Now, for ssh, I'm not all that familiar with it. My guess is that you don't
have it setup passwordless, but I'm not sure about that. You can try the
LIBVIRT_DEBUG=1 trick here to get some additional information.
For what it's worth, oVirt is using the ruby-libvirt bindings extensively via
the kerberos mechanism (qemu+tcp://, and then the appropriate kerberos
configuration in /etc/libvirt/libvirt.conf). But it sounds like your issues are
more fundamental configuration issues.
Chris Lalancette