WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxenlight: Destroy device model only fo

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxenlight: Destroy device model only for domains that have it
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 03 Dec 2009 23:20:29 -0800
Delivery-date: Thu, 03 Dec 2009 23:21:25 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1259910622 0
# Node ID 27e02e517be5cfd249ba9693cae43fa18e9d7ff1
# Parent  cabc1f9341e46fb156e4aa9184ded86adc62a700
libxenlight: Destroy device model only for domains that have it

Destroy device model only for domains that have it.

Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
---
 tools/libxl/libxl.c |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff -r cabc1f9341e4 -r 27e02e517be5 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Fri Dec 04 07:09:44 2009 +0000
+++ b/tools/libxl/libxl.c       Fri Dec 04 07:10:22 2009 +0000
@@ -489,7 +489,16 @@ int libxl_domain_destroy(struct libxl_ct
     char *dom_path, *uuid_str;
     char vm_path[UUID_LEN_STR + 5], vss_path[UUID_LEN_STR + 6], xapi_path[20];
     xen_uuid_t *uuid;
-    int rc;
+    int rc, dm_present;
+
+    if (is_hvm(ctx, domid)) {
+        dm_present = 1;
+    } else {
+        char *pid;
+        pid = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, 
"/local/domain/%d/image/device-model-pid", domid));
+        dm_present = (pid != NULL);
+        libxl_free(ctx, pid);
+    }
 
     dom_path = libxl_xs_get_dompath(ctx, domid);
     if (!dom_path)
@@ -501,16 +510,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 (dm_present) {
+        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 (dm_present) {
+        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))

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxenlight: Destroy device model only for domains that have it, Xen patchbot-unstable <=