This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] Re: [PATCH]: xl: Check a domain exists before destroying it

Gianni Tedesco writes ("[PATCH]: xl: Check a domain exists before destroying 
> This is quite a clever fix but I think Ian Jacksons comments are
> correct. We should do a libxl_domain_info() and bail early in the
> destroy path if that fails.

Thanks, I have applied the libxl part of this patch.

The xl_cmdimpl part:
> Also fix a mis-formatted error message in xl destroy command.
misses three other similar mistakes.

$ egrep '\\n.\"' tools/libxl/*.c
tools/libxl/xl_cmdimpl.c:    if (rc) { fprintf(stderr,"destroy failed 
(rc=%d)\n.",rc); exit(-1); }
tools/libxl/xl_cmdimpl.c:    if (rc) { fprintf(stderr,"shutdown failed 
(rc=%d)\n.",rc);exit(-1); }
tools/libxl/xl_cmdimpl.c:    if (rc) { fprintf(stderr,"reboot failed 
(rc=%d)\n.",rc);exit(-1); }
tools/libxl/xl_cmdimpl.c:    if (rc) { fprintf(stderr,"core dump failed 
(rc=%d)\n.",rc);exit(-1); }

Also in general most of the messages from xl don't print full stops.
So I suggest the patch below instead.


xl: fix up some minor mistakes in error messages

perl -i~ -pe 's/\\n.\"/\\n\"/' tools/libxl/*.c

Reported-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

diff -r 787af706dadc tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Tue Jan 25 17:02:47 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Tue Jan 25 17:06:46 2011 +0000
@@ -2176,7 +2176,7 @@ static void destroy_domain(const char *p
     rc = libxl_domain_destroy(&ctx, domid, 0);
-    if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n.",rc); exit(-1); }
+    if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n",rc); exit(-1); }
 static void shutdown_domain(const char *p, int wait)
@@ -2185,7 +2185,7 @@ static void shutdown_domain(const char *
     rc=libxl_domain_shutdown(&ctx, domid, 0);
-    if (rc) { fprintf(stderr,"shutdown failed (rc=%d)\n.",rc);exit(-1); }
+    if (rc) { fprintf(stderr,"shutdown failed (rc=%d)\n",rc);exit(-1); }
     if (wait) {
         libxl_waiter waiter;
@@ -2227,7 +2227,7 @@ static void reboot_domain(const char *p)
     int rc;
     rc=libxl_domain_shutdown(&ctx, domid, 1);
-    if (rc) { fprintf(stderr,"reboot failed (rc=%d)\n.",rc);exit(-1); }
+    if (rc) { fprintf(stderr,"reboot failed (rc=%d)\n",rc);exit(-1); }
 static void list_domains_details(const libxl_dominfo *info, int nb_domain)
@@ -2669,7 +2669,7 @@ static void core_dump_domain(const char 
     int rc;
     rc=libxl_domain_core_dump(&ctx, domid, filename);
-    if (rc) { fprintf(stderr,"core dump failed (rc=%d)\n.",rc);exit(-1); }
+    if (rc) { fprintf(stderr,"core dump failed (rc=%d)\n",rc);exit(-1); }
 static void migrate_receive(int debug, int daemonize)

Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>