diff mbox

[08/28] libxl: libxl__destroy_domid: Bring dm destruction together

Message ID 1450809903-3393-9-git-send-email-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Jackson Dec. 22, 2015, 6:44 p.m. UTC
Change the order of operations so that the dm determination and
destruction occur together.

The functional change is that the xenstore reads relating to the dm
determination now occur after the pci devices have been removed and
the domain has been paused.  This should not have any visible effect.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
v6: New patch.
---
 tools/libxl/libxl.c |   25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)
diff mbox

Patch

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index d96189d..1ac5d81 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1621,6 +1621,19 @@  void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis)
         goto out;
     }
 
+    if (libxl__device_pci_destroy_all(gc, domid) < 0)
+        LOG(ERROR, "pci shutdown failed for domid %d", domid);
+    rc = xc_domain_pause(ctx->xch, domid);
+    if (rc < 0) {
+        LOGEV(ERROR, rc, "xc_domain_pause failed for %d", domid);
+    }
+
+    dom_path = libxl__xs_get_dompath(gc, domid);
+    if (!dom_path) {
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
     switch (libxl__domain_type(gc, domid)) {
     case LIBXL_DOMAIN_TYPE_HVM:
         if (libxl_get_stubdom_id(CTX, domid)) {
@@ -1639,18 +1652,6 @@  void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis)
         abort();
     }
 
-    dom_path = libxl__xs_get_dompath(gc, domid);
-    if (!dom_path) {
-        rc = ERROR_FAIL;
-        goto out;
-    }
-
-    if (libxl__device_pci_destroy_all(gc, domid) < 0)
-        LOG(ERROR, "pci shutdown failed for domid %d", domid);
-    rc = xc_domain_pause(ctx->xch, domid);
-    if (rc < 0) {
-        LOGEV(ERROR, rc, "xc_domain_pause failed for %d", domid);
-    }
     if (dm_present) {
         if (libxl__destroy_device_model(gc, domid) < 0)
             LOG(ERROR, "libxl__destroy_device_model failed for %d", domid);