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

Re: [Xen-devel] [PATCH v2 07/15] libxl: convert libxl_domain_destroy to an async op



Roger Pau Monne wrote:
This change introduces some new structures, and breaks the mutual
dependency that libxl_domain_destroy and libxl__destroy_device_model
had. This is done by checking if the domid passed to
libxl_domain_destroy has a stubdom, and then having the bulk of the
destroy machinery in a separate function (libxl__destroy_domid) that
doesn't check for stubdom presence, since we check for it in the upper
level function. The reason behind this change is the need to use
structures for ao operations, and it was impossible to have two
different self-referencing structs.

All uses of libxl_domain_destroy have been changed, and either
replaced by the new libxl_domain_destroy ao function or by the
internal libxl__domain_destroy that can be used inside an already
running ao.

Cc: Ian Jackson<ian.jackson@xxxxxxxxxxxxx>
Signed-off-by: Roger Pau Monne<roger.pau@xxxxxxxxxx>
---
  tools/libxl/libxl.c          |  167 +++++++++++++++++++++++++++++++++---
  tools/libxl/libxl.h          |    3 +-
  tools/libxl/libxl_create.c   |   29 ++++++-
  tools/libxl/libxl_device.c   |  192 ++++++++++++++++++++++++++++++++++--------
  tools/libxl/libxl_dm.c       |   85 ++++++++++---------
  tools/libxl/libxl_internal.h |   90 +++++++++++++++++++-
  tools/libxl/xl_cmdimpl.c     |   12 ++--
  7 files changed, 473 insertions(+), 105 deletions(-)

[ ...]

@@ -413,30 +490,40 @@ int libxl__devices_destroy(libxl__gc *gc, uint32_t domid)
              path = libxl__sprintf(gc, "/local/domain/%d/device/%s/%s/backend",
                                    domid, kinds[i], devs[j]);
              path = libxl__xs_read(gc, XBT_NULL, path);
-            if (path&&  libxl__parse_backend_path(gc, path,&dev) == 0) {
-                dev.domid = domid;
-                dev.kind = kind;
-                dev.devid = atoi(devs[j]);
-
-                libxl__device_destroy(gc,&dev);
+            printf("device: %s\n", path);

This should not be here.

+            GCNEW(dev);
+            if (path&&  libxl__parse_backend_path(gc, path, dev) == 0) {
+                dev->domid = domid;
+                dev->kind = kind;
+                dev->devid = atoi(devs[j]);
+                drs->aorm[numdev].action = DEVICE_DISCONNECT;
+                drs->aorm[numdev].dev = dev;
+                drs->aorm[numdev].callback = device_remove_callback;
+                drs->aorm[numdev].force = drs->force;
+                libxl__initiate_device_remove(egc,&drs->aorm[numdev]);
+                numdev++;
              }
          }
      }

      /* console 0 frontend directory is not under /local/domain/<domid>/device 
*/
      path = libxl__sprintf(gc, "/local/domain/%d/console/backend", domid);
+    printf("frontend: %s\n", path);
      path = libxl__xs_read(gc, XBT_NULL, path);
+    printf("backend: %s\n", path);

Neither should this. I will resend without this printfs, but please ignore them for review.

[...]

_______________________________________________
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®.