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

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



it is a bug reported by customer, xl will output the following message
when issue "xl list --long domain_name":
Domain name must be specified.

the error message is completely unclear. this error is because such
domain is not created by xl itself. xl could saw the domain name but
could not get the domain configuration.

Signed-off-by: Bamvor Jian Zhang <bjzhang@xxxxxxxx>
---
change since RFC:
raise the error in list_domains_details instead of modifying the 
libxl_userdata_retrieve itself.
there are four command would invoke the libxl_userdata_retrieve: create, 
save, migrate, list. issue create command mean the domain is not called
from other toolstack, and there is libxl_userdata_retrieve return value
check in save and migrate. So, the only place need to check is in
list_domain_details.

 tools/libxl/xl_cmdimpl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index a8261be..81bdb91 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -3064,6 +3064,11 @@ static void list_domains_details(const libxl_dominfo 
*info, int nb_domain)
         rc = libxl_userdata_retrieve(ctx, info[i].domid, "xl", &data, &len);
         if (rc)
             continue;
+        if (len == 0) {
+            fprintf(stderr, "No xl userdata found. Is domain id"
+                    "'%u' owned by another toolstack?", info[i].domid);
+            continue;
+        }
         CHK_ERRNO(asprintf(&config_source, "<domid %d data>", info[i].domid));
         libxl_domain_config_init(&d_config);
         parse_config_data(config_source, (char *)data, len, &d_config, NULL);
-- 
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®.