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

[Xen-devel] [PATCH 5 of 9] libxl: only use interactive PyGrub mode when a console is attached



# HG changeset patch
# User Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
# Date 1317386335 -7200
# Node ID 84a27a9f39f29194a7344e842b2055f592a42250
# Parent  156626fef95b36184ad44dfcb049bae2545435f0
libxl: only use interactive PyGrub mode when a console is attached

Sometimes PyGrub freezed when trying to create a domain without the console 
attached (without "-c"). This patch adds the "-q" option to PyGrub when "-c" is 
not specified at creation time. PyGrub freezed trying to set terminal 
attributes (like reset_prog_mode or nocbreak).

Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>

diff -r 156626fef95b -r 84a27a9f39f2 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Fri Sep 30 14:38:55 2011 +0200
+++ b/tools/libxl/libxl.h       Fri Sep 30 14:38:55 2011 +0200
@@ -287,7 +287,8 @@ int libxl_get_max_cpus(libxl_ctx *ctx);
 int libxl_run_bootloader(libxl_ctx *ctx,
                          libxl_domain_build_info *info,
                          libxl_device_disk *disk,
-                         uint32_t domid);
+                         uint32_t domid,
+                         libxl_console_ready cb);
 
   /* 0 means ERROR_ENOMEM, which we have logged */
 
diff -r 156626fef95b -r 84a27a9f39f2 tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c    Fri Sep 30 14:38:55 2011 +0200
+++ b/tools/libxl/libxl_bootloader.c    Fri Sep 30 14:38:55 2011 +0200
@@ -33,7 +33,8 @@
 static char **make_bootloader_args(libxl__gc *gc,
                                    libxl_domain_build_info *info,
                                    uint32_t domid,
-                                   const char *fifo, char *disk)
+                                   const char *fifo, char *disk,
+                                   libxl_console_ready cb)
 {
     flexarray_t *args;
     int nr = 0;
@@ -55,6 +56,8 @@ static char **make_bootloader_args(libxl
     flexarray_set(args, nr++, libxl__sprintf(gc, "--output=%s", fifo));
     flexarray_set(args, nr++, "--output-format=simple0");
     flexarray_set(args, nr++, libxl__sprintf(gc, "--output-directory=%s", 
"/var/run/libxl/"));
+    if (!cb)
+        flexarray_set(args, nr++, "-q");
 
     if (info->u.pv.bootloader_args) {
         char *saveptr;
@@ -300,7 +303,8 @@ static void parse_bootloader_result(libx
 int libxl_run_bootloader(libxl_ctx *ctx,
                          libxl_domain_build_info *info,
                          libxl_device_disk *disk,
-                         uint32_t domid)
+                         uint32_t domid,
+                         libxl_console_ready cb)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
     int ret, rc = 0;
@@ -362,7 +366,7 @@ int libxl_run_bootloader(libxl_ctx *ctx,
         goto out_close;
     }
 
-    args = make_bootloader_args(&gc, info, domid, fifo, diskpath);
+    args = make_bootloader_args(&gc, info, domid, fifo, diskpath, cb);
     if (args == NULL) {
         rc = ERROR_NOMEM;
         goto out_close;
diff -r 156626fef95b -r 84a27a9f39f2 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Fri Sep 30 14:38:55 2011 +0200
+++ b/tools/libxl/libxl_create.c        Fri Sep 30 14:38:55 2011 +0200
@@ -461,7 +461,7 @@ static int do_domain_create(libxl__gc *g
     }
 
     if ( restore_fd < 0 ) {
-        ret = libxl_run_bootloader(ctx, &d_config->b_info, d_config->num_disks 
> 0 ? &d_config->disks[0] : NULL, domid);
+        ret = libxl_run_bootloader(ctx, &d_config->b_info, d_config->num_disks 
> 0 ? &d_config->disks[0] : NULL, domid, cb);
         if (ret) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
                        "failed to run bootloader: %d", ret);

_______________________________________________
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®.