|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH V4 23/24] libxl: consider force removal of device successful
If a device is force removed and the force removal successes, from
guest's PoV this device is gone. So the toolstack should consider this a
successful case as well.
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
tools/libxl/libxl_device.c | 12 ++++++++++--
tools/libxl/libxl_internal.h | 4 ++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index fa99f77..7a37778 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -845,6 +845,11 @@ void libxl__initiate_device_remove(libxl__egc *egc,
if (rc < 0) goto out;
}
+ /* At this point the XS transaction is commited. So check if we
+ * force removal of the device.
+ */
+ aodev->force_removed = aodev->force;
+
rc = libxl__ev_devstate_wait(gc, &aodev->backend_ds,
device_backend_callback,
state_path, XenbusStateClosed,
@@ -928,7 +933,7 @@ static void device_backend_callback(libxl__egc *egc,
libxl__ev_devstate *ds,
return;
}
- if (rc) {
+ if (rc && !aodev->force_removed) {
LOG(ERROR, "unable to %s device with path %s",
libxl__device_action_to_string(aodev->action),
libxl__device_backend_path(gc, aodev->dev));
@@ -939,7 +944,10 @@ static void device_backend_callback(libxl__egc *egc,
libxl__ev_devstate *ds,
return;
out:
- aodev->rc = rc;
+ /* If force removal is successful, the device is gone from guest's
+ * PoV. The toolstack should consider it successful too.
+ */
+ aodev->rc = aodev->force_removed ? 0 : rc;
device_hotplug_done(egc, aodev);
return;
}
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 6e3d19d..cf9af6b 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -2078,6 +2078,10 @@ struct libxl__ao_device {
libxl__device_action action;
libxl__device *dev;
int force;
+ /* If force removal is successful, force_removed=1. The device is
+ * gone from guest's PoV
+ */
+ int force_removed;
libxl__device_callback *callback;
/* return value, zeroed by user on entry, is valid on callback */
int rc;
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |