Patch to 'ping' XenD when opening connection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently the XenD driver's implementation of the 'open' method will return
success, regardless of whether XenD is even present. The attached patch
makes the open method do a 'ping' to see if XenD is actually there, returning
failure if it is not. This ensures that the XenD driver backend doesn't get
activated when connecting to alternate non-Xen backends, such as the test
backend I committed last week.  

The current 'ping' is simply to call the xenDaemonGetVersion() method since
that's a pretty simle & low-overhead way to testing livliness of XenD. Any
suggestions for a better ping - if not I'll go ahead & commit this change 

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
Index: src/xend_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.c,v
retrieving revision 1.26
diff -u -r1.26 xend_internal.c
--- src/xend_internal.c	27 Apr 2006 14:14:23 -0000	1.26
+++ src/xend_internal.c	12 Jun 2006 15:58:37 -0000
@@ -1651,6 +1651,7 @@
 {
     xmlURIPtr uri;
     int ret;
+    unsigned long version;
 
     if (name == NULL) {
         name = "http://localhost:8000/";;
@@ -1663,8 +1664,17 @@
     }
 
     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")); */
 

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]