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

Re: [Xen-devel] libxenlight and xl: missing features

To: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] libxenlight and xl: missing features
From: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>
Date: Fri, 30 Apr 2010 10:26:04 +0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Thu, 29 Apr 2010 19:26:18 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <alpine.DEB.2.00.1004221726500.11380@kaball-desktop>
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>
References: <alpine.DEB.2.00.1004221726500.11380@kaball-desktop>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 3.0a1 (Windows/2008050715)
Hi Stefano,

Stefano Stabellini wrote:
> Hi all,
> this is a non comprehensive list of missing features in libxenlight
> and\or xl:
> 
...
> 
> - -c option to xl create;
> 

How about the following patch.
* I made it base changeset 21236:9a1d7caa2024.

Regards
Yu Zhiguo

--------------------------------------------------------------
Add option '-c' for 'xl create'
* -c Connect to the console after the domain is created.

Signed-off-by: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>

diff -r 9a1d7caa2024 -r 880b6a219189 tools/libxl/xl.c
--- a/tools/libxl/xl.c  Mon Apr 26 12:13:23 2010 +0100
+++ b/tools/libxl/xl.c  Fri Apr 30 17:58:25 2010 +0800
@@ -976,7 +976,7 @@
         libxl_domain_unpause(&ctx, domid);
 
     if (!daemonize)
-        return 0; /* caller gets success in parent */
+        return domid; /* caller gets success in parent */
 
     if (need_daemon) {
         char *fullname, *name;
@@ -1000,7 +1000,7 @@
                            "daemonizing child", child1, status);
                 return ERROR_FAIL;
             }
-            return 0; /* caller gets success in parent */
+            return domid; /* caller gets success in parent */
         }
 
         rc = libxl_ctx_postfork(&ctx);
@@ -1113,6 +1113,7 @@
         printf("Options:\n\n");
         printf("-h                     Print this help.\n");
         printf("-p                     Leave the domain paused after it is 
created.\n");
+        printf("-c                     Connect to the console after the domain 
is created.\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")) {
@@ -1937,7 +1938,7 @@
                        0 /* no config file, use incoming */,
                        "incoming migration stream", 1,
                        0, &migration_domname);
-    if (rc) {
+    if (rc < 0) {
         fprintf(stderr, "migration target: Domain creation failed"
                 " (code %d).\n", rc);
         exit(-rc);
@@ -2047,7 +2048,10 @@
     }
     rc = create_domain(debug, daemonize, config_file,
                        checkpoint_file, paused, -1, 0);
-    exit(-rc);
+    if (rc >= 0)
+        exit(0);
+    else
+        exit(-rc);
 }
 
 int main_migrate_receive(int argc, char **argv)
@@ -2291,14 +2295,18 @@
 int main_create(int argc, char **argv)
 {
     char *filename = NULL;
-    int paused = 0, debug = 0, daemonize = 1;
+    char dom[10]; /* long enough */
+    int paused = 0, debug = 0, daemonize = 1, console_autoconnect = 0;
     int opt, rc;
 
-    while ((opt = getopt(argc, argv, "hdep")) != -1) {
+    while ((opt = getopt(argc, argv, "hpcde")) != -1) {
         switch (opt) {
         case 'p':
             paused = 1;
             break;
+        case 'c':
+            console_autoconnect = 1;
+            break;
         case 'd':
             debug = 1;
             break;
@@ -2322,7 +2330,14 @@
     filename = argv[optind];
     rc = create_domain(debug, daemonize, filename, NULL, paused,
                        -1, 0);
-    exit(-rc);
+    if (rc > 0) {
+        if (console_autoconnect) {
+            snprintf(dom, sizeof(dom), "%d", rc);
+            console(dom, 0);
+        }
+        exit(0);
+    } else
+        exit(-rc);
 }
 
 void button_press(char *p, char *b)




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

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