[virt-tools-list] [virt-manager PATCH] virt-install: add support for adding multi consoles
Chen Hanxiao
chenhanxiao at cn.fujitsu.com
Wed Jan 29 08:53:20 UTC 2014
From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
This patch will add support for adding multiple
default consoles, with command:
virt-install --console N
Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
virtinst/cli.py | 12 ++++++++++--
virtinst/guest.py | 6 +++++-
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/virtinst/cli.py b/virtinst/cli.py
index bad1b17..7184764 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2083,10 +2083,18 @@ class _ParserChar(VirtCLIParser):
self.set_param(None, "target_address", setter_cb=set_target_cb)
def _parse(self, opts, inst):
- if opts.fullopts == "none" and inst.virtual_device_type == "console":
+ tmp_str = opts.fullopts
+ device_type = inst.virtual_device_type
+ if tmp_str == "none" and device_type == "console":
self.guest.skip_default_console = True
return
- if opts.fullopts == "none" and inst.virtual_device_type == "channel":
+ if tmp_str.lstrip("-").isdigit() and device_type == "console":
+ num = int(opts.fullopts)
+ if num < 1:
+ num = 1
+ self.guest.console_num = num
+ return
+ if tmp_str == "none" and device_type == "channel":
self.guest.skip_default_channel = True
return
diff --git a/virtinst/guest.py b/virtinst/guest.py
index c50bc03..ee73875 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -105,6 +105,7 @@ class Guest(XMLBuilder):
self.skip_default_console = False
self.skip_default_channel = False
+ self.console_num = 1
self._os_variant = None
self._random_uuid = None
@@ -538,7 +539,10 @@ class Guest(XMLBuilder):
self.conn.SUPPORT_CONN_VIRTIO_CONSOLE)):
dev.target_type = "virtio"
- self.add_device(dev)
+ count = self.console_num
+ while count >= 1:
+ self.add_device(dev)
+ count -= 1
def add_default_video_device(self):
if self.os.is_container():
--
1.8.2.1
More information about the virt-tools-list
mailing list