All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] improve the error message in "xl list --long"
@ 2013-10-17 16:21 Bamvor Jian Zhang
  2013-10-17 16:24 ` Ian Jackson
  2013-10-17 16:25 ` Andrew Cooper
  0 siblings, 2 replies; 6+ messages in thread
From: Bamvor Jian Zhang @ 2013-10-17 16:21 UTC (permalink / raw)
  To: xen-devel; +Cc: jfehlig, ian.jackson, Bamvor Jian Zhang

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@suse.com>
---
 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-10-17 20:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-17 16:21 [PATCH RFC] improve the error message in "xl list --long" Bamvor Jian Zhang
2013-10-17 16:24 ` Ian Jackson
2013-10-17 16:58   ` Bamvor Jian Zhang
2013-10-17 17:25     ` Ian Jackson
2013-10-17 20:38       ` Jim Fehlig
2013-10-17 16:25 ` Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.