WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] libxenlight: add a cli option to exit right after do

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] libxenlight: add a cli option to exit right after domain creation
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Wed, 9 Dec 2009 15:41:23 +0000
Delivery-date: Wed, 09 Dec 2009 07:37:32 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
Hi all,
this patch adds a command line option in xl to exit right after domain
creation and not wait in background for the death of the domain.
Users should be aware that if they use this option, they always have to
destroy the domain manually after the guest shuts down.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

---

diff -r 594f350f0828 tools/libxl/xl.c
--- a/tools/libxl/xl.c  Wed Dec 09 13:21:56 2009 +0000
+++ b/tools/libxl/xl.c  Wed Dec 09 15:29:43 2009 +0000
@@ -581,7 +581,7 @@
         }                                                               \
     })
 
-static void create_domain(int debug, const char *config_file, const char 
*restore_file, int paused)
+static void create_domain(int debug, int daemonize, const char *config_file, 
const char *restore_file, int paused)
 {
     struct libxl_ctx ctx;
     uint32_t domid;
@@ -663,6 +663,9 @@
 
     if (!paused)
         libxl_domain_unpause(&ctx, domid);
+
+    if (!daemonize)
+        exit(0);
 
     if (need_daemon) {
         char *fullname, *name;
@@ -764,6 +767,7 @@
         printf("Options:\n\n");
         printf("-h                     Print this help.\n");
         printf("-d                     Enable debug messages.\n");
+        printf("-e                     Do not wait in the background for the 
death of the domain.\n");
     } else if(!strcmp(command, "list")) {
         printf("Usage: xl list [Domain]\n\n");
         printf("List information about all/some domains.\n\n");
@@ -794,6 +798,7 @@
         printf("Options:\n\n");
         printf("-h                     Print this help.\n");
         printf("-p                     Do not unpause domain after restoring 
it.\n");
+        printf("-e                     Do not wait in the background for the 
death of the domain.\n");
     } else if(!strcmp(command, "destroy")) {
         printf("Usage: xl destroy <Domain>\n\n");
         printf("Terminate a domain immediately.\n\n");
@@ -1259,16 +1264,19 @@
 {
     char *checkpoint_file = NULL;
     char *config_file = NULL;
-    int paused = 0, debug = 0;
+    int paused = 0, debug = 0, daemonize = 1;
     int opt;
 
-    while ((opt = getopt(argc, argv, "hpd")) != -1) {
+    while ((opt = getopt(argc, argv, "hpde")) != -1) {
         switch (opt) {
         case 'p':
             paused = 1;
             break;
         case 'd':
             debug = 1;
+            break;
+        case 'e':
+            daemonize = 0;
             break;
         case 'h':
             help("restore");
@@ -1286,7 +1294,7 @@
 
     config_file = argv[optind];
     checkpoint_file = argv[optind + 1];
-    create_domain(debug, config_file, checkpoint_file, paused);
+    create_domain(debug, daemonize, config_file, checkpoint_file, paused);
     exit(0);
 }
 
@@ -1423,13 +1431,16 @@
 int main_create(int argc, char **argv)
 {
     char *filename = NULL;
-    int debug = 0;
+    int debug = 0, daemonize = 1;
     int opt;
 
-    while ((opt = getopt(argc, argv, "hd")) != -1) {
+    while ((opt = getopt(argc, argv, "hde")) != -1) {
         switch (opt) {
         case 'd':
             debug = 1;
+            break;
+        case 'e':
+            daemonize = 0;
             break;
         case 'h':
             help("create");
@@ -1446,7 +1457,7 @@
     }
 
     filename = argv[optind];
-    create_domain(debug, filename, NULL, 0);
+    create_domain(debug, daemonize, filename, NULL, 0);
     exit(0);
 }
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] libxenlight: add a cli option to exit right after domain creation, Stefano Stabellini <=