]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/qemu-xen.git/commitdiff
xen: use existing global libxc handle in destroy_hvm_domain
authorIan Campbell <ian.campbell@citrix.com>
Thu, 28 Jan 2016 14:48:31 +0000 (14:48 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 11 Feb 2016 16:16:42 +0000 (16:16 +0000)
This handle is perfectly good, no reason I can see not to use it.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
xen-hvm.c

index d9b57f70d59eb03d8cb91d8b6bf85e3f1c64f779..921269cc3439741da18e3ec24ee33428778ce272 100644 (file)
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -1027,24 +1027,17 @@ static void handle_buffered_io(void *opaque)
 
 static void destroy_hvm_domain(bool reboot)
 {
-    xc_interface *xc_handle;
     int sts;
 
-    xc_handle = xc_interface_open(0, 0, 0);
-    if (xc_handle == NULL) {
-        fprintf(stderr, "Cannot acquire xenctrl handle\n");
+    sts = xc_domain_shutdown(xen_xc, xen_domid,
+                             reboot ? SHUTDOWN_reboot : SHUTDOWN_poweroff);
+    if (sts != 0) {
+        fprintf(stderr, "xc_domain_shutdown failed to issue %s, "
+                "sts %d, %s\n", reboot ? "reboot" : "poweroff",
+                sts, strerror(errno));
     } else {
-        sts = xc_domain_shutdown(xc_handle, xen_domid,
-                                 reboot ? SHUTDOWN_reboot : SHUTDOWN_poweroff);
-        if (sts != 0) {
-            fprintf(stderr, "xc_domain_shutdown failed to issue %s, "
-                    "sts %d, %s\n", reboot ? "reboot" : "poweroff",
-                    sts, strerror(errno));
-        } else {
-            fprintf(stderr, "Issued domain %d %s\n", xen_domid,
-                    reboot ? "reboot" : "poweroff");
-        }
-        xc_interface_close(xc_handle);
+        fprintf(stderr, "Issued domain %d %s\n", xen_domid,
+                reboot ? "reboot" : "poweroff");
     }
 }