]> xenbits.xensource.com Git - libvirt.git/commitdiff
Do a 'ping' test when opening connection to verify XenD really is there & alive
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 12 Jun 2006 22:21:04 +0000 (22:21 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 12 Jun 2006 22:21:04 +0000 (22:21 +0000)
ChangeLog
src/xend_internal.c

index 9def3aaa20b790f5ed3102025afef5564c8add14..0474e13430d11186aa1873281564b304dc2884c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Jun 12 17:22:24 EDT 2006 Daniel P. Berrange <berrange@redhat.com>
+
+       * src/xend_internal.c: Call 'xenDomainGetVersion' when trying
+       to open a connection, as a sort of "ping" test to verify the
+       Xen daemon connection - fail the open method, if the "ping" is
+       not successful.
+
 Mon Jun 05 22:31:20 EDT 2006 Daniel P. Berrange <berrange@redhat.com>
 
        * src/test.c, src/test.h: New 'mock' hypervisor driver providing
index 64cd72edda9004d20fa07ccdc44713937e60268b..37e5934f1b4d7e75dd4df395c4d71a3f07aba8f4 100644 (file)
@@ -1651,6 +1651,7 @@ xenDaemonOpen(virConnectPtr conn, const char *name, int flags)
 {
     xmlURIPtr uri;
     int ret;
+    unsigned long version;
 
     if (name == NULL) {
         name = "http://localhost:8000/";
@@ -1663,8 +1664,17 @@ xenDaemonOpen(virConnectPtr conn, const char *name, int flags)
     }
 
     xmlFreeURI(uri);
-    
-    return (xenDaemonOpen_tcp(conn, "localhost", 8000));
+
+    ret = xenDaemonOpen_tcp(conn, "localhost", 8000);
+    if (ret < 0) {
+      return ret;
+    }
+
+    /* A sort of "ping" to make sure the daemon is actually
+       alive & well, rather than just assuming it is */
+    if ((ret = xenDaemonGetVersion(conn, &version)) < 0) {
+      return ret;
+    }
 
 /*    return(xenDaemonOpen_unix(conn, "/var/lib/xend/xend-socket")); */