[libvirt] Probs connecting QEMU hypervisor with URL ?

Hi, i tried to use virt-viewer to connect to a remote machine running libvirt & kvm-qemu at FC9 - but it failed. So, I run virsh without the URL directly on FC9, it works (e.g. virsh list). If I use a connection URL, it failed. Did I miss something ? regards Danny [root@xxx03 ~]# virsh list Id Name State ---------------------------------- oot@xxx03 ~]# virsh -c qemu+tls://localhost list libvir: Remote error : Certificate's owner does not match the hostname (localhost) libvir: Remote error : unable to connect to 'localhost': Invalid argument error: failed to connect to the hypervisor [root@xxx03 ~]# virsh -c qemu+tls://xxx03.domainname.com list libvir: error : could not connect to qemu:// error: failed to connect to the hypervisor *** Port is available: [root@ xxx03 ~]# netstat -nl | grep 16514 tcp 0 0 0.0.0.0:16514 0.0.0.0:* LISTEN *** Also, a ssh does not work: [root@xxx03 ~]# virsh -c qemu+ssh://xxx03.domainname.com list root@xxx03.domainname.com password: libvir: error : could not connect to qemu:// error: failed to connect to the hypervisor ** Connecting directly works: [root@ xxx03 ~]# virsh -c qemu:///system list Id Name State ---------------------------------- ** but not with the remote name like [root@ xxx03 ~]# virsh -c qemu://xxx03.domainname.com /system list libvir: error : could not connect to qemu://xxx03.domainname.com /system error: failed to connect to the hypervisor

One more - i tried do debug this problem with the debug-enviroment variable - it seems like libvirt can't connect the qemu hypervisor ... Hmm, in xen-enviroment, there's a xend daemon running - but in qemu-enviroment ? There's no separate daemon "qemud" or similar running ... so, again's which or what will libvirt try to connect to ? Maybe a remote access to from libirt to qemu CAN NOT work ? maybe this would be a additional info for libvirt-docu ? regards Danny [root@xen03 ~]# LIBVIRT_DEBUG=SPAM virsh -c qemu+tls://xxx03.domainname.com DEBUG: libvirt.c: virInitialize (register drivers) DEBUG: libvirt.c: virRegisterDriver (registering Test as driver 0) DEBUG: libvirt.c: virRegisterNetworkDriver (registering Test as network driver 0) DEBUG: libvirt.c: virRegisterStorageDriver (registering Test as storage driver 0) DEBUG: libvirt.c: virRegisterDriver (registering Xen as driver 1) DEBUG: libvirt.c: virRegisterDriver (registering OPENVZ as driver 2) DEBUG: libvirt.c: virRegisterDriver (registering remote as driver 3) DEBUG: libvirt.c: virRegisterNetworkDriver (registering remote as network driver 1) DEBUG: libvirt.c: virRegisterStorageDriver (registering remote as storage driver 1) DEBUG: libvirt.c: virRegisterDeviceMonitor (registering remote as device driver 0) DEBUG: libvirt.c: virConnectOpenAuth (name=qemu+tls://xxx03.domainname.com, auth=0x35ce2930a0, flags=0) DEBUG: libvirt.c: do_open (name "qemu+tls://xxx03.domainname.com" to URI components: scheme qemu+tls opaque (null) authority (null) server xxx03.domainname.com user (null) port 0 path ) DEBUG: libvirt.c: do_open (trying driver 0 (Test) ...) DEBUG: libvirt.c: do_open (driver 0 Test returned DECLINED) DEBUG: libvirt.c: do_open (trying driver 1 (Xen) ...) DEBUG: libvirt.c: do_open (driver 1 Xen returned DECLINED) DEBUG: libvirt.c: do_open (trying driver 2 (OPENVZ) ...) DEBUG: libvirt.c: do_open (driver 2 OPENVZ returned DECLINED) DEBUG: libvirt.c: do_open (trying driver 3 (remote) ...) DEBUG: remote_internal.c: doRemoteOpen (proceeding with name = qemu://) DEBUG: remote_internal.c: initialise_gnutls (loading CA file /etc/pki/CA/cacert.pem) DEBUG: remote_internal.c: initialise_gnutls (loading client cert and key from files /etc/pki/libvirt/clientcert.pem and /etc/pki/libvirt/private/clientkey.pem) libvir: Fehler : could not connect to qemu:// DEBUG: libvirt.c: do_open (driver 3 remote returned ERROR) DEBUG: datatypes.c: virUnrefConnect (unref connection 0x1c60120 1) DEBUG: datatypes.c: virReleaseConnect (release connection 0x1c60120) Fehler: Verbindung zum Hypervisor scheiterte [root@xxx03 ~]# [root@ xxx03 ~]# virsh version Kompiliert gegen die Bibliothek: libvir 0.5.1 Verwende Bibliothek: libvir 0.5.1 Verwende API: QEMU 0.5.1 Laufender Hypervisor: QEMU 0.9.1

On Thu, Jan 22, 2009 at 06:10:47PM +0100, Daniel Schwager wrote:
[root@xxx03 ~]# virsh list Id Name State ----------------------------------
oot@xxx03 ~]# virsh -c qemu+tls://localhost list libvir: Remote error : Certificate's owner does not match the hostname (localhost) libvir: Remote error : unable to connect to 'localhost': Invalid argument error: failed to connect to the hypervisor
This is simply due to SSL certs containing the hostname, which must match the hostname you connect to, so you can't use localhost with SSL.
[root@xxx03 ~]# virsh -c qemu+tls://xxx03.domainname.com list libvir: error : could not connect to qemu:// error: failed to connect to the hypervisor
This is missing the /system on the end of the URL
[root@xxx03 ~]# virsh -c qemu+ssh://xxx03.domainname.com list root@xxx03.domainname.com password: libvir: error : could not connect to qemu:// error: failed to connect to the hypervisor
Again missing the trailing /system on the URL
** Connecting directly works:
[root@ xxx03 ~]# virsh -c qemu:///system list Id Name State ----------------------------------
** but not with the remote name like [root@ xxx03 ~]# virsh -c qemu://xxx03.domainname.com /system list libvir: error : could not connect to qemu://xxx03.domainname.com /system error: failed to connect to the hypervisor
You have a space in the URI between the hostname and the '/system' bit for some reason You need virsh -c qemu://xxx03.domainname.com/system Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

You need
virsh -c qemu://xxx03.domainname.com/system
Yes sir - here we are ... you are right. With xen, you DO NOT need the "system" in the URL. The following works for xen - but not for qemu: [root@xen04 ~]$ virsh -c xen+tls://xen04.domainname.com list Id Name State This is a little bit inconsequent/confusing (-: But, if it's known, it's easy... regards Danny

On Thu, Jan 22, 2009 at 09:30:50PM +0100, Daniel Schwager wrote:
You need
virsh -c qemu://xxx03.domainname.com/system
Yes sir - here we are ... you are right.
With xen, you DO NOT need the "system" in the URL.
Xen is less flexible than QEMU. You can only have a single Xen connection per host. With QEMU you can have a system wide instance, or a per-user instance (qemu:///session).
The following works for xen - but not for qemu:
[root@xen04 ~]$ virsh -c xen+tls://xen04.domainname.com list Id Name State
This is a little bit inconsequent/confusing (-: But, if it's known, it's easy...
http://libvirt.org/uri.html Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (2)
-
Daniel P. Berrange
-
Daniel Schwager