libxl,xl: Fix two minor bugs in domain destruction
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 12 Apr 2010 16:45:26 +0000 (17:45 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 12 Apr 2010 16:45:26 +0000 (17:45 +0100)
* If /local/domain/<domid>/device does not exist, this is not
  necessarily an error.  It probably means the domain has been
  partially destroyed already.

* Have xl report errors from libxl_domain_destroy.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
tools/libxl/libxl_device.c
tools/libxl/xl.c

index 9fdd0b477a223968a5cd8cd159d656b2129c00fd..ca2008070d46e09a82452e1e3c6a5aad150a515b 100644 (file)
@@ -301,7 +301,7 @@ int libxl_devices_destroy(struct libxl_ctx *ctx, uint32_t domid, int force)
     if (!l1) {
         XL_LOG(&clone, XL_LOG_ERROR, "%s is empty", path);
         libxl_ctx_free(&clone);
-        return -1;
+        return 0;
     }
     for (i = 0; i < num1; i++) {
         if (!strcmp("vfs", l1[i]))
index ccf012a08d27ccee6e7e45e0a9f079466900d973..33329ca0c6eb7a5d3ffd92e1543c985635258b4d 100644 (file)
@@ -1277,8 +1277,10 @@ void unpause_domain(char *p)
 
 void destroy_domain(char *p)
 {
+    int rc;
     find_domain(p);
-    libxl_domain_destroy(&ctx, domid, 0);
+    rc = libxl_domain_destroy(&ctx, domid, 0);
+    if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n.",rc); exit(-1); }
 }
 
 void list_domains(int verbose)