From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: [PATCH 5/6] libxl: during domain destruction, do not complain if no devices dir to destroy Date: Thu, 27 Jan 2011 17:41:03 +0000 Message-ID: <1296150064-31991-6-git-send-email-ian.jackson@eu.citrix.com> References: <1296150064-31991-1-git-send-email-ian.jackson@eu.citrix.com> <1296150064-31991-2-git-send-email-ian.jackson@eu.citrix.com> <1296150064-31991-3-git-send-email-ian.jackson@eu.citrix.com> <1296150064-31991-4-git-send-email-ian.jackson@eu.citrix.com> <1296150064-31991-5-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: <1296150064-31991-5-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Ian Jackson , Ian Jackson List-Id: xen-devel@lists.xenproject.org Previously calling libxl__devices_destroy on a half-constructed or half-destroyed domain would sometimes complain along these lines: libxl: error: libxl_device.c:327:libxl__devices_destroy /local/domain/29/device is empty This is (a) not a reasonable thing to complain about and (b) not an accurate description of all the things that that particular failure of libxl__xs_directory might mean. Change the code to check errno, so that if errno==ENOENT we silently continue, not destroying any devices, and if errno!=ENOENT, properly log the problem and fail. Signed-off-by: Ian Jackson --- tools/libxl/libxl_device.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index cf694d2..a7f3bda 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -324,8 +324,12 @@ int libxl__devices_destroy(libxl_ctx *ctx, uint32_t domid, int force) path = libxl__sprintf(&gc, "/local/domain/%d/device", domid); l1 = libxl__xs_directory(&gc, XBT_NULL, path, &num1); if (!l1) { - LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "%s is empty", path); - goto out; + if (errno != ENOENT) { + LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unable to get xenstore" + " device listing %s", path); + goto out; + } + num1 = 0; } for (i = 0; i < num1; i++) { if (!strcmp("vfs", l1[i])) -- 1.5.6.5