From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: [PATCH 6/6] libxl: Add more logging to hotplug script path Date: Mon, 6 Jul 2015 11:51:43 +0100 Message-ID: <1436179903-449-7-git-send-email-george.dunlap@eu.citrix.com> References: <1436179903-449-1-git-send-email-george.dunlap@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1436179903-449-1-git-send-email-george.dunlap@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: George Dunlap , Ian Jackson , Wei Liu , Ian Campbell List-Id: xen-devel@lists.xenproject.org This was useful in tracking down bugs. Signed-off-by: George Dunlap --- CC: Ian Campbell CC: Ian Jackson CC: Wei Liu --- tools/libxl/libxl_device.c | 20 +++++++++++++++++--- tools/libxl/libxl_linux.c | 5 +++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index c1ca07b..d2ae42f 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -920,11 +920,13 @@ static void device_backend_callback(libxl__egc *egc, libxl__ev_devstate *ds, 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; @@ -967,10 +969,18 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev) * 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"; @@ -978,8 +988,11 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev) 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; } @@ -991,6 +1004,7 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev) switch (hotplug) { case 0: /* no hotplug script to execute */ + LOG(DEBUG, "No hotplug script to execute"); goto out; case 1: /* execute hotplug script */ diff --git a/tools/libxl/libxl_linux.c b/tools/libxl/libxl_linux.c index 512d2c9..4fbcba1 100644 --- a/tools/libxl/libxl_linux.c +++ b/tools/libxl/libxl_linux.c @@ -214,6 +214,7 @@ static int libxl__hotplug_disk(libxl__gc *gc, libxl__device *dev, *env = get_hotplug_env(gc, script, dev); if (!*env) { + LOG(ERROR, "Failed to get hotplug environment"); rc = ERROR_FAIL; goto error; } @@ -225,6 +226,7 @@ static int libxl__hotplug_disk(libxl__gc *gc, libxl__device *dev, (*args)[nr++] = NULL; assert(nr == arraysize); + LOG(DEBUG, "Args and environment ready"); rc = 1; error: @@ -241,6 +243,7 @@ int libxl__get_hotplug_script_info(libxl__gc *gc, libxl__device *dev, 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; } @@ -253,6 +256,7 @@ int libxl__get_hotplug_script_info(libxl__gc *gc, libxl__device *dev, */ 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; } @@ -260,6 +264,7 @@ int libxl__get_hotplug_script_info(libxl__gc *gc, libxl__device *dev, 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; } -- 1.9.1