[virt-tools-list] [virt-manager PATCH] virtinst: do not add default channels if one is already present

Giuseppe Scrivano gscrivan at redhat.com
Fri Jan 9 11:29:06 UTC 2015


Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1179680

Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
 .../compare/virt-install-channel-only-pty.xml      | 91 ++++++++++++++++++++++
 tests/clitest.py                                   |  1 +
 virtinst/cli.py                                    |  7 +-
 3 files changed, 96 insertions(+), 3 deletions(-)
 create mode 100644 tests/cli-test-xml/compare/virt-install-channel-only-pty.xml

diff --git a/tests/cli-test-xml/compare/virt-install-channel-only-pty.xml b/tests/cli-test-xml/compare/virt-install-channel-only-pty.xml
new file mode 100644
index 0000000..faaae47
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-install-channel-only-pty.xml
@@ -0,0 +1,91 @@
+<domain type="test">
+  <name>foobar</name>
+  <uuid>00000000-1111-2222-3333-444444444444</uuid>
+  <memory>65536</memory>
+  <currentMemory>65536</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch="i686">hvm</type>
+    <boot dev="cdrom"/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset="utc"/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>destroy</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/test-hv</emulator>
+    <disk type="file" device="cdrom">
+      <source file="/dev/default-pool/testvol1.img"/>
+      <target dev="hda" bus="ide"/>
+      <readonly/>
+    </disk>
+    <controller type="usb" index="0" model="ich9-ehci1"/>
+    <controller type="usb" index="0" model="ich9-uhci1">
+      <master startport="0"/>
+    </controller>
+    <controller type="usb" index="0" model="ich9-uhci2">
+      <master startport="2"/>
+    </controller>
+    <controller type="usb" index="0" model="ich9-uhci3">
+      <master startport="4"/>
+    </controller>
+    <interface type="user">
+      <mac address="00:11:22:33:44:55"/>
+    </interface>
+    <input type="mouse" bus="ps2"/>
+    <console type="pty"/>
+    <channel type="pty">
+      <target type="virtio"/>
+    </channel>
+  </devices>
+</domain>
+<domain type="test">
+  <name>foobar</name>
+  <uuid>00000000-1111-2222-3333-444444444444</uuid>
+  <memory>65536</memory>
+  <currentMemory>65536</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch="i686">hvm</type>
+    <boot dev="hd"/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset="utc"/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/bin/test-hv</emulator>
+    <disk type="block" device="cdrom">
+      <target dev="hda" bus="ide"/>
+      <readonly/>
+    </disk>
+    <controller type="usb" index="0" model="ich9-ehci1"/>
+    <controller type="usb" index="0" model="ich9-uhci1">
+      <master startport="0"/>
+    </controller>
+    <controller type="usb" index="0" model="ich9-uhci2">
+      <master startport="2"/>
+    </controller>
+    <controller type="usb" index="0" model="ich9-uhci3">
+      <master startport="4"/>
+    </controller>
+    <interface type="user">
+      <mac address="00:11:22:33:44:55"/>
+    </interface>
+    <input type="mouse" bus="ps2"/>
+    <console type="pty"/>
+    <channel type="pty">
+      <target type="virtio"/>
+    </channel>
+  </devices>
+</domain>
diff --git a/tests/clitest.py b/tests/clitest.py
index b35fd43..6c65622 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -723,6 +723,7 @@ c.add_compare("", "noargs-fail", auto_printarg=False)  # No arguments
 c.add_valid("--panic help --disk=?")  # Make sure introspection doesn't blow up
 c.add_invalid("--hvm --nodisks --pxe foobar")  # Positional arguments error
 c.add_invalid("--nodisks --pxe --name test")  # Colliding name
+c.add_compare("--nodisks --cdrom %(EXISTIMG1)s --channel pty,target_type=virtio", "channel-only-pty")  # Only one channel
 
 
 
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 00294fb..4748e07 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1,7 +1,7 @@
 #
 # Utility functions for the command line drivers
 #
-# Copyright 2006-2007, 2013, 2014 Red Hat, Inc.
+# Copyright 2006-2007, 2013, 2014, 2015 Red Hat, Inc.
 # Jeremy Katz <katzj at redhat.com>
 #
 # This program is free software; you can redistribute it and/or modify
@@ -2002,9 +2002,10 @@ class _ParserChar(VirtCLIParser):
         if opts.fullopts == "none" and inst.virtual_device_type == "console":
             self.guest.skip_default_console = True
             return
-        if opts.fullopts == "none" and inst.virtual_device_type == "channel":
+        if inst.virtual_device_type == "channel":
             self.guest.skip_default_channel = True
-            return
+            if opts.fullopts == "none":
+                return
 
         return VirtCLIParser._parse(self, opts, inst)
 
-- 
2.1.0




More information about the virt-tools-list mailing list