Skip to contentSkip to conversation

: xl: tell the user non-existent domain er

PATCH Applied Andre Przywara 2 participants 2 messages Aug 9, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 : xl: tell the user non-existent domain er

Hi,

the error message when one wants to list a non-existent domain is at best misleading (libxl_domain_info failed (code -5)). Attached patch catches this specific error and tells the user that the requested domain does not exist:

# xl list 42
Error: Domain '42' does not exist.

I am not sure whether one should change the default error message in find_domain(), too, which currently reads:

# xl list foo
foo is an invalid domain identifier (rc=-1)

Regards,
Andre.

Signature · 3 lines
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 448-3567-12
tools/libxl/xl_cmdimpl.c +5 -0
diff -r 8992134dcfd0 tools/libxl/xl_cmdimpl.c
@@ -3000,6 +2999,11 @@
     } else if (optind == argc-1) {
         find_domain(argv[optind]);
         rc = libxl_domain_info(&ctx, &info_buf, domid);
+        if (rc == ERROR_INVAL) {
+            fprintf(stderr, "Error: Domain \'%s\' does not exist.\n",
+                argv[optind]);
+            return -rc;
+        }
         if (rc) {
             fprintf(stderr, "libxl_domain_info failed (code %d).\n", rc);
             return -rc;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 9 lines · Andre Przywara

Hi,

the error message when one wants to list a non-existent domain is at best misleading (libxl_domain_info failed (code -5)). Attached patch catches this specific error and tells the user that the requested domain does not exist:

# xl list 42
Error: Domain '42' does not exist.

applied, thanks.

Quoted 5 lines

I am not sure whether one should change the default error message in find_domain(), too, which currently reads:

# xl list foo
foo is an invalid domain identifier (rc=-1)

I think the error message for find_domain is not too bad