[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 09/28] libxl: Move some error handling and cleanup into libxl__destroy_device_model



Move
 - the error log message
 - the call to libxl__qmp_cleanup
into libxl__destroy_device_model from the one call site in
libxl__destroy_domid.

We are going to want to call libxl__destroy_device_model more than
once, and this code would otherwise need to be repeated for the other
call site(s).

The call site now completely ignores the error, sadly.  But I am not
intending in this series to try to undertake destruction
error-handling cleanup as well.

No functional change other than slight change to the error message.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
v6: New patch.
---
 tools/libxl/libxl.c    |    4 +---
 tools/libxl/libxl_dm.c |   10 +++++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 1ac5d81..5414649 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1653,10 +1653,8 @@ void libxl__destroy_domid(libxl__egc *egc, 
libxl__destroy_domid_state *dis)
     }
 
     if (dm_present) {
-        if (libxl__destroy_device_model(gc, domid) < 0)
-            LOG(ERROR, "libxl__destroy_device_model failed for %d", domid);
+        libxl__destroy_device_model(gc, domid);
 
-        libxl__qmp_cleanup(gc, domid);
     }
     dis->drs.ao = ao;
     dis->drs.domid = domid;
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index ea82e11..b85b377 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -2099,13 +2099,21 @@ out:
 
 int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid)
 {
+    int rc;
+
     char *path = libxl__device_model_xs_path(gc, LIBXL_TOOLSTACK_DOMID,
                                              domid, EMUID_DM, "");
     if (!xs_rm(CTX->xsh, XBT_NULL, path))
         LOG(ERROR, "xs_rm failed for %s", path);
     /* We should try to destroy the device model anyway. */
-    return kill_device_model(gc,
+    rc = kill_device_model(gc,
                 GCSPRINTF("/local/domain/%d/image/device-model-pid", domid));
+    if (rc)
+        LOG(ERROR, "libxl__destroy_device_model failed for %d",
+            domid);
+
+    libxl__qmp_cleanup(gc, domid);
+    return rc;
 }
 
 int libxl__need_xenpv_qemu(libxl__gc *gc,
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.