From d4103eac264c627164407c6d6319a224dd32ae5b Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 6 Oct 2013 09:41:37 -0400 Subject: [PATCH] virt-install: Add '--console none' and '--channel none' For skipping the default channel and default console behavior --- tests/cli-test-xml/compare/kvm-f14-url.xml | 20 -------------------- tests/clitest.py | 2 +- virtinst/cli.py | 7 +++++++ virtinst/guest.py | 10 ++++++++++ 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/tests/cli-test-xml/compare/kvm-f14-url.xml b/tests/cli-test-xml/compare/kvm-f14-url.xml index 0c404bb20..9fd0edd50 100644 --- a/tests/cli-test-xml/compare/kvm-f14-url.xml +++ b/tests/cli-test-xml/compare/kvm-f14-url.xml @@ -64,16 +64,6 @@ - - - - - - - - - - @@ -143,16 +133,6 @@ - - - - - - - - - - diff --git a/tests/clitest.py b/tests/clitest.py index 4b16d5788..a1cf6937d 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -466,7 +466,7 @@ c.add_valid("--nodisks --boot hd --paravirt --arch i686") # 32 on 64 xen c = vinst.add_category("kvm", "--connect %(KVMURI)s --noautoconsole") -c.add_compare("--os-variant fedora20 --file %(EXISTIMG1)s --location %(TREEDIR)s --extra-args console=ttyS0 --cpu host", "kvm-f14-url") # F14 Directory tree URL install with extra-args +c.add_compare("--os-variant fedora20 --file %(EXISTIMG1)s --location %(TREEDIR)s --extra-args console=ttyS0 --cpu host --channel none --console none", "kvm-f14-url") # F14 Directory tree URL install with extra-args c.add_compare("--os-variant fedora20 --disk %(NEWIMG1)s,size=.01 --location %(TREEDIR)s --extra-args console=ttyS0 --quiet", "quiet-url") # Quiet URL install should make no noise c.add_compare("--cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --wait 0 --sound --controller usb", "kvm-win2k3-cdrom") # HVM windows install with disk c.add_compare("--os-variant fedora20 --nodisks --boot hd --paravirt", "kvm-xenner") # xenner diff --git a/virtinst/cli.py b/virtinst/cli.py index 744c1eae7..f8cedda0d 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -1756,6 +1756,13 @@ def _parse_char(guest, optstr, dev): opts = parse_optstr(optstr, remove_first="char_type") ctype = opts.get("char_type") + if ctype == "none" and dev_type == "console": + guest.skip_default_console = True + return + if ctype == "none" and dev_type == "channel": + guest.skip_default_channel = True + return + def support_check(dev, paramname, dictname): if type(paramname) is not str: return diff --git a/virtinst/guest.py b/virtinst/guest.py index 549094402..65f86fde1 100644 --- a/virtinst/guest.py +++ b/virtinst/guest.py @@ -103,6 +103,9 @@ class Guest(XMLBuilder): # Allow virt-manager to override the default graphics type self.default_graphics_type = cliconfig.default_graphics + self.skip_default_console = False + self.skip_default_channel = False + self._os_variant = None self._random_uuid = None self._install_devices = [] @@ -519,6 +522,8 @@ class Guest(XMLBuilder): self.add_device(virtinst.VirtualAudio(self.conn)) def add_default_console_device(self): + if self.skip_default_console: + return if self.os.is_xenpv(): return if self.get_devices("console") or self.get_devices("serial"): @@ -558,6 +563,8 @@ class Guest(XMLBuilder): self.add_device(dev) def add_default_channels(self): + if self.skip_default_channel: + return if self.get_devices("channel"): return @@ -856,6 +863,9 @@ class Guest(XMLBuilder): if chn.type == chn.TYPE_SPICEVMC: return True + if self.skip_default_channel: + return + if (not has_spice_agent() and self.conn.check_conn_support( self.conn.SUPPORT_CONN_CHAR_SPICEVMC)):