From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andre Przywara Subject: [PATCH 2/3]: xl: tell the user non-existent domain er Date: Mon, 9 Aug 2010 15:55:22 +0200 Message-ID: <4C6008CA.7030801@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070700060005010306060708" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Yang Hongyang , Keir Fraser Cc: xen-devel List-Id: xen-devel@lists.xenproject.org --------------070700060005010306060708 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit 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-Operating System Research Center (OSRC), Dresden, Germany Tel: +49 351 448-3567-12 --------------070700060005010306060708 Content-Type: text/x-patch; name="libxl_list_2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="libxl_list_2.patch" 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; --------------070700060005010306060708 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------070700060005010306060708--