From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andres Lagar-Cavilla Subject: [PATCH 07/14]: libxenlight, destroy device-model only for hvm domains Date: Mon, 30 Nov 2009 14:13:49 -0500 Message-ID: <4B14196D.8010603@lagarcavilla.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050401080305050004030602" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Stefano Stabellini , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------050401080305050004030602 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Destroy device-model only for hvm domains. Signed-off-by: Andres Lagar-Cavilla --------------050401080305050004030602 Content-Type: text/x-patch; name="07_destroy_dm_only_hvm.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="07_destroy_dm_only_hvm.patch" # HG changeset patch # User Andres Lagar-Cavilla # Date 1259253630 18000 # Node ID 05e2dad9b117e80c8daf55a30cb7eeda3fda4764 # Parent a19e1cef7b72a90b3cc9c8c38dadf06aaf413155 Destroy device-model only for hvm domains. Signed-off-by: Andres Lagar-Cavilla diff -r a19e1cef7b72 -r 05e2dad9b117 libxl.c --- a/libxl.c +++ b/libxl.c @@ -443,8 +443,9 @@ int libxl_domain_destroy(struct libxl_ct { char *dom_path, vm_path[41]; xen_uuid_t *uuid; - int rc; + int rc, hvm; + hvm = is_hvm(ctx, domid); dom_path = libxl_xs_get_dompath(ctx, domid); if (!dom_path) return -1; @@ -455,16 +456,20 @@ int libxl_domain_destroy(struct libxl_ct } if (libxl_device_pci_shutdown(ctx, domid) < 0) XL_LOG(ctx, XL_LOG_ERROR, "pci shutdown failed for domid %d", domid); - xs_write(ctx->xsh, XBT_NULL, - libxl_sprintf(ctx, "/local/domain/0/device-model/%d/command", domid), - "shutdown", strlen("shutdown")); + if (hvm) { + xs_write(ctx->xsh, XBT_NULL, + libxl_sprintf(ctx, "/local/domain/0/device-model/%d/command", domid), + "shutdown", strlen("shutdown")); + } rc = xc_domain_pause(ctx->xch, domid); if (rc < 0) { XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_domain_pause failed for %d", domid); return -1; } - if (libxl_destroy_device_model(ctx, domid) < 0) - XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_device_model failed for %d", domid); + if (hvm) { + if (libxl_destroy_device_model(ctx, domid) < 0) + XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_device_model failed for %d", domid); + } if (libxl_devices_destroy(ctx, domid, force) < 0) XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_devices failed for %d", domid); if (!xs_rm(ctx->xsh, XBT_NULL, dom_path)) --------------050401080305050004030602 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------050401080305050004030602--