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

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



Gianni Tedesco writes ("[PATCH]: xl: Check a domain exists before destroying 
it"):
> 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.

Ian.


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
         exit(-1);
     }
     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 *
 
     find_domain(p);
     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;
     find_domain(p);
     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;
     find_domain(domain_spec);
     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
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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