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

[Xen-devel] [PATCH v2 2/2] xl: Accept a list for serial in config file



Allow the "serial" key to accept a list of serial ports, and pass
them in using the new serial_list domain build element.

For backwards compatibility, still accept singleton values.

Also update the xl.cfg manpage.

This patch borrows substantially from the multiple USB device patch
c3a2148192705592d38407ba9919eb1eb151a153.

Signed-off-by: Ed White <edmund.h.white@xxxxxxxxx>

---

Changes in v2:
- CC Ian Jackson.
---
 docs/man/xl.cfg.pod.5    |  6 ++++--
 tools/libxl/xl_cmdimpl.c | 19 ++++++++++++++++++-
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
index ff9ea77..0ac0744 100644
--- a/docs/man/xl.cfg.pod.5
+++ b/docs/man/xl.cfg.pod.5
@@ -1259,13 +1259,15 @@ an usb2 controller. The default is disabled (0).

 =over 4

-=item B<serial=DEVICE>
+=item B<serial=[ "DEVICE", "DEVICE", ...]>

-Redirect the virtual serial port to B<DEVICE>. Please see the
+Redirect virtual serial ports to B<DEVICE>s. Please see the
 B<-serial> option in the L<qemu(1)> manpage for details of the valid
 B<DEVICE> options. Default is B<vc> when in graphical mode and
 B<stdio> if B<nographics=1> is used.

+The form serial=DEVICE is also accepted for backwards compatibilty.
+
 =item B<soundhw=DEVICE>

 Select the virtual sound card to expose to the guest. The valid
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 01bce2f..50f9b15 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1643,7 +1643,24 @@ skip_vfb:
         xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0);
         xlu_cfg_get_defbool(config, "gfx_passthru",
                             &b_info->u.hvm.gfx_passthru, 0);
-        xlu_cfg_replace_string (config, "serial", &b_info->u.hvm.serial, 0);
+        switch (xlu_cfg_get_list_as_string_list(config, "serial",
+                                                &b_info->u.hvm.serial_list,
+                                                1))
+        {
+
+        case 0: break; /* Success */
+        case ESRCH: break; /* Option not present */
+        case EINVAL:
+            /* If it's not a valid list, try reading it as an atom,
+             * falling through to an error if it fails */
+            if (!xlu_cfg_replace_string(config, "serial",
+                                        &b_info->u.hvm.serial, 0))
+                break;
+            /* FALLTHRU */
+        default:
+            fprintf(stderr,"xl: Unable to parse serial.\n");
+            exit(-ERROR_FAIL);
+        }
         xlu_cfg_replace_string (config, "boot", &b_info->u.hvm.boot, 0);
         xlu_cfg_get_defbool(config, "usb", &b_info->u.hvm.usb, 0);
         if (!xlu_cfg_get_long (config, "usbversion", &l, 0))
--
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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