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

[Xen-changelog] [xen-unstable] xl: tell the user about non-existent domains



# HG changeset patch
# User Stefano Stabellini <sstabellini@xxxxxxxxxxxxx>
# Date 1281370070 -3600
# Node ID 493d70234c97f58a23fc00ec8ec527a4eeabc960
# Parent  8500a5eb41afa8f0a1bc93cf88714db451780068
xl: tell the user about non-existent domains

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

Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |    5 +++++
 1 files changed, 5 insertions(+)

diff -r 8500a5eb41af -r 493d70234c97 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Mon Aug 09 17:05:51 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Mon Aug 09 17:07:50 2010 +0100
@@ -3003,6 +3003,11 @@ int main_list(int argc, char **argv)
     } 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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.