From: Ian Campbell Date: Thu, 28 Jan 2016 14:48:31 +0000 (+0000) Subject: xen: use existing global libxc handle in destroy_hvm_domain X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9d076bfe5331fa618722599d13b90fecf46fb8dc;p=people%2Fliuw%2Flibxenctrl-split%2Fqemu-xen.git xen: use existing global libxc handle in destroy_hvm_domain This handle is perfectly good, no reason I can see not to use it. Signed-off-by: Ian Campbell --- diff --git a/xen-hvm.c b/xen-hvm.c index d9b57f70d..921269cc3 100644 --- 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"); } }