xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3]: xl: tell the user non-existent domain er
@ 2010-08-09 13:55 Andre Przywara
  2010-08-09 16:12 ` Stefano Stabellini
  0 siblings, 1 reply; 2+ messages in thread
From: Andre Przywara @ 2010-08-09 13:55 UTC (permalink / raw)
  To: Yang Hongyang, Keir Fraser; +Cc: xen-devel

[-- Attachment #1: Type: text/plain, Size: 635 bytes --]

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.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>

-- 
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 448-3567-12

[-- Attachment #2: libxl_list_2.patch --]
[-- Type: text/x-patch, Size: 614 bytes --]

diff -r 8992134dcfd0 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed Aug 04 19:24:17 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Mon Aug 09 16:03:31 2010 +0200
@@ -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;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

* Re: [PATCH 2/3]: xl: tell the user non-existent domain er
  2010-08-09 13:55 [PATCH 2/3]: xl: tell the user non-existent domain er Andre Przywara
@ 2010-08-09 16:12 ` Stefano Stabellini
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Stabellini @ 2010-08-09 16:12 UTC (permalink / raw)
  To: Andre Przywara; +Cc: xen-devel, Yang Hongyang, Keir Fraser

On Mon, 9 Aug 2010, Andre Przywara wrote:
> 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.

> 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

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

end of thread, other threads:[~2010-08-09 16:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-09 13:55 [PATCH 2/3]: xl: tell the user non-existent domain er Andre Przywara
2010-08-09 16:12 ` Stefano Stabellini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).