libxl__ao_device *aodev = CONTAINER_OF(ds, *aodev, backend_ds);
STATE_AO_GC(aodev->ao);
+ LOG(DEBUG, "calling device_backend_cleanup");
device_backend_cleanup(gc, aodev);
if (rc == ERROR_TIMEDOUT &&
aodev->action == LIBXL__DEVICE_ACTION_REMOVE &&
!aodev->force) {
+ LOG(DEBUG, "Timeout reached, initiating forced remove");
aodev->force = 1;
libxl__initiate_device_remove(egc, aodev);
return;
* hotplug scripts
*/
rc = libxl__get_domid(gc, &domid);
- if (rc) goto out;
+ if (rc) {
+ LOG(ERROR, "Failed to get domid");
+ goto out;
+ }
if (aodev->dev->backend_domid != domid) {
- if (aodev->action != LIBXL__DEVICE_ACTION_REMOVE)
+ LOG(DEBUG, "Backend domid %d, domid %d, assuming driver domains",
+ aodev->dev->backend_domid, domid);
+
+ if (aodev->action != LIBXL__DEVICE_ACTION_REMOVE) {
+ LOG(DEBUG, "Not a remove, not executing hotplug scripts");
goto out;
+ }
aodev->xswait.ao = ao;
aodev->xswait.what = "removal of backend path";
aodev->xswait.timeout_ms = LIBXL_DESTROY_TIMEOUT * 1000;
aodev->xswait.callback = device_destroy_be_watch_cb;
rc = libxl__xswait_start(gc, &aodev->xswait);
- if (rc)
+ if (rc) {
+ LOG(ERROR, "Setup of backend removal watch failed (path %s)", be_path);
goto out;
+ }
+
return;
}
switch (hotplug) {
case 0:
/* no hotplug script to execute */
+ LOG(DEBUG, "No hotplug script to execute");
goto out;
case 1:
/* execute hotplug script */
*env = get_hotplug_env(gc, script, dev);
if (!*env) {
+ LOG(ERROR, "Failed to get hotplug environment");
rc = ERROR_FAIL;
goto error;
}
(*args)[nr++] = NULL;
assert(nr == arraysize);
+ LOG(DEBUG, "Args and environment ready");
rc = 1;
error:
switch (dev->backend_kind) {
case LIBXL__DEVICE_KIND_VBD:
if (num_exec != 0) {
+ LOG(DEBUG, "num_exec %d, not running hotplug scripts\n", num_exec);
rc = 0;
goto out;
}
*/
if ((num_exec > 1) ||
(libxl_get_stubdom_id(CTX, dev->domid) && num_exec)) {
+ LOG(DEBUG, "num_exec %d, not running hotplug scripts\n", num_exec);
rc = 0;
goto out;
}
break;
default:
/* No need to execute any hotplug scripts */
+ LOG(DEBUG, "backend_kind %d, no need to execute scripts", dev->backend_kind);
rc = 0;
break;
}