Skip to contentSkip to conversation

Clear device-model information when destroying an HVM domain with stubdom-v3

PATCH Jun Zhu (Intern) 1 participant 1 message Sep 14, 2010

lore
Share & tools
lore
#0 lore raw

Clear device-model information when destroying an HVM domain with stubdom-v4.

# HG changeset patch
# User Jun Zhu <[email protected]>
# Date 1284474545 -3600
# Node ID 3ce8a7f5a56d44e4ecef5ccd8ab54813d0cfb9bf
# Parent 65010d314adb1efe0674b2c1e7337affc6dbe57b
Clear device-model information when destroying an HVM domain with stubdom

tools/libxl/libxl.c +17 -12
diff -r 65010d314adb -r 3ce8a7f5a56d tools/libxl/libxl.c
@@ -899,21 +899,26 @@
         }
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device model is a stubdom, domid=%d\n", stubdomid);
         ret = libxl_domain_destroy(ctx, stubdomid, 0);
-        goto out;
+        if (ret)
+            goto out;
+    }
+    else {
+        ret = kill(atoi(pid), SIGHUP);
+        if (ret < 0 && errno == ESRCH) {
+            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Device Model already exited");
+            ret = 0;
+        } else if (ret == 0) {
+            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Device Model signaled");
+            ret = 0;
+        } else {
+            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to kill Device Model [%d]",
+                    atoi(pid));
+            ret = ERROR_FAIL;
+            goto out;
+        }
     }
     xs_rm(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "/local/domain/0/device-model/%d", domid));
 
-    ret = kill(atoi(pid), SIGHUP);
-    if (ret < 0 && errno == ESRCH) {
-        LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Device Model already exited");
-        ret = 0;
-    } else if (ret == 0) {
-        LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Device Model signaled");
-        ret = 0;
-    } else {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to kill Device Model [%d]",
-                     atoi(pid));
-    }
 out:
     libxl__free_all(&gc);
     return ret;

Jun Zhu
Citrix Systems UK