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

[Xen-devel] [PATCH RFC] improve the error message in "xl list --long"



with this patch, xl will raise a proper error when execute "xl list --long"
for existed domain but no domain configuration found. it would encounter
if other toolstack(like libvirt) create the vm, xl could saw the domain
name but could not get the domain configuration.

there is a commit a76377f1 check the return value of
libxl_read_file_contents in libxl_userdata_retrieve. but skip the ENOENT.
it is almost three years before. i do not know the senario about that
commit. it seems that it is not safe to simplely remove the ENOENT.

Signed-off-by: Bamvor Jian Zhang <bjzhang@xxxxxxxx>
---
 tools/libxl/libxl_dom.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 356f920..8daf51a 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -1655,6 +1655,12 @@ int libxl_userdata_retrieve(libxl_ctx *ctx, uint32_t 
domid,
         goto out;
     }
 
+    if (access(filename, F_OK) != 0) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Unknown domain configuration. Is 
domain id '%u' owned by another libxl toolstack?", domid);
+        rc = ERROR_INVAL;
+        goto out;
+    }
+
     e = libxl_read_file_contents(ctx, filename, data_r ? &data : 0, &datalen);
     if (e && errno != ENOENT) {
         rc = ERROR_FAIL;
-- 
1.8.1.4


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