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-changelog

[Xen-changelog] [xen-unstable] libxenlight: add a cli option to exit rig

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxenlight: add a cli option to exit right after domain creation
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 11 Dec 2009 01:10:24 -0800
Delivery-date: Fri, 11 Dec 2009 01:16:28 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1260521162 0
# Node ID 8fbc74d40739febc9e8c8df8b76d9c753f7fe049
# Parent  9575425fdebd1f5d3c218be4d8dbedc8b7e462ea
libxenlight: add a cli option to exit right after domain creation

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>
---
 tools/libxl/xl.c |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diff -r 9575425fdebd -r 8fbc74d40739 tools/libxl/xl.c
--- a/tools/libxl/xl.c  Fri Dec 11 08:45:26 2009 +0000
+++ b/tools/libxl/xl.c  Fri Dec 11 08:46:02 2009 +0000
@@ -581,7 +581,7 @@ skip_pci:
         }                                                               \
     })
 
-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 @@ start:
 
     if (!paused)
         libxl_domain_unpause(&ctx, domid);
+
+    if (!daemonize)
+        exit(0);
 
     if (need_daemon) {
         char *fullname, *name;
@@ -764,6 +767,7 @@ static void help(char *command)
         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 @@ static void help(char *command)
         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 @@ int main_restore(int argc, char **argv)
 {
     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 @@ int main_restore(int argc, char **argv)
 
     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)
 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 @@ int main_create(int argc, char **argv)
     }
 
     filename = argv[optind];
-    create_domain(debug, filename, NULL, 0);
+    create_domain(debug, daemonize, filename, NULL, 0);
     exit(0);
 }
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxenlight: add a cli option to exit right after domain creation, Xen patchbot-unstable <=