debuggers.hg

changeset 21993:493d70234c97

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@amd.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
author Stefano Stabellini <sstabellini@xensource.com>
date Mon Aug 09 17:07:50 2010 +0100 (2010-08-09)
parents 8500a5eb41af
children fdf12cb3e2d1
files tools/libxl/xl_cmdimpl.c
line diff
     1.1 --- a/tools/libxl/xl_cmdimpl.c	Mon Aug 09 17:05:51 2010 +0100
     1.2 +++ b/tools/libxl/xl_cmdimpl.c	Mon Aug 09 17:07:50 2010 +0100
     1.3 @@ -3003,6 +3003,11 @@ int main_list(int argc, char **argv)
     1.4      } else if (optind == argc-1) {
     1.5          find_domain(argv[optind]);
     1.6          rc = libxl_domain_info(&ctx, &info_buf, domid);
     1.7 +        if (rc == ERROR_INVAL) {
     1.8 +            fprintf(stderr, "Error: Domain \'%s\' does not exist.\n",
     1.9 +                argv[optind]);
    1.10 +            return -rc;
    1.11 +        }
    1.12          if (rc) {
    1.13              fprintf(stderr, "libxl_domain_info failed (code %d).\n", rc);
    1.14              return -rc;