[virt-tools-list] [virt-manager PATCH] Use virtio-net only when it is supported
Giuseppe Scrivano
gscrivan at redhat.com
Wed Feb 25 12:08:31 UTC 2015
Do not use the model specified by the OS if it is "virtio-net" and
virtionet is not supported.
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1177113
Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
tests/xmlconfig-xml/install-no-virtionet-xen.xml | 49 ++++++++++++++++++++++++
virtinst/guest.py | 12 +++---
2 files changed, 56 insertions(+), 5 deletions(-)
create mode 100644 tests/xmlconfig-xml/install-no-virtionet-xen.xml
diff --git a/tests/xmlconfig-xml/install-no-virtionet-xen.xml b/tests/xmlconfig-xml/install-no-virtionet-xen.xml
new file mode 100644
index 0000000..c6ac58e
--- /dev/null
+++ b/tests/xmlconfig-xml/install-no-virtionet-xen.xml
@@ -0,0 +1,49 @@
+<domain type="xen">
+ <name>TestGuest</name>
+ <uuid>12345678-1234-1234-1234-123456789012</uuid>
+ <memory>409600</memory>
+ <currentMemory>204800</currentMemory>
+ <vcpu>5</vcpu>
+ <os>
+ <type arch="i686">hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev="cdrom"/>
+ <boot dev="hd"/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ </features>
+ <clock offset="utc"/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
+ <disk type="file" device="floppy">
+ <source file="/dev/default-pool/testvol1.img"/>
+ <target dev="fda" bus="fdc"/>
+ </disk>
+ <disk type="file" device="disk">
+ <source file="/dev/default-pool/new-test-suite.img"/>
+ <target dev="hda" bus="ide"/>
+ </disk>
+ <disk type="block" device="disk">
+ <source dev="/dev/disk-pool/diskvol1"/>
+ <target dev="hdb" bus="ide"/>
+ </disk>
+ <disk type="file" device="cdrom">
+ <source file="/dev/null"/>
+ <target dev="hdc" bus="ide"/>
+ <readonly/>
+ </disk>
+ <interface type="network">
+ <source network="default"/>
+ <mac address="22:22:33:44:55:66"/>
+ </interface>
+ <input type="tablet" bus="usb"/>
+ <graphics type="vnc" port="-1" keymap="ja"/>
+ <console type="pty"/>
+ <sound model="es1370"/>
+ </devices>
+</domain>
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 68b3730..830044b 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -963,16 +963,18 @@ class Guest(XMLBuilder):
used_targets.append(disk.generate_target(used_targets))
def _set_net_defaults(self):
+ net_model = None
+ variant = osdict.lookup_os(self.os_variant)
if not self.os.is_hvm():
net_model = None
elif self._can_virtio("virtionet"):
net_model = "virtio"
- else:
+ elif variant and not variant.virtionet:
net_model = self._lookup_osdict_key("netmodel", None)
-
- for net in self.get_devices("interface"):
- if net_model and not net.model:
- net.model = net_model
+ if net_model:
+ for net in self.get_devices("interface"):
+ if not net.model:
+ net.model = net_model
def _set_input_defaults(self):
input_type = self._lookup_osdict_key("inputtype", "mouse")
--
2.1.0
More information about the virt-tools-list
mailing list