[libvirt] [PATCH] qemu: Default to virtio network devices on ppc64

Andrea Bolognani abologna at redhat.com
Mon Aug 31 12:39:08 UTC 2015


Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1254044
---
 src/qemu/qemu_domain.c                                     |  3 ++-
 .../qemuxml2argvdata/qemuxml2argv-pseries-net-default.args |  6 ++++++
 .../qemuxml2argvdata/qemuxml2argv-pseries-net-default.xml  | 14 ++++++++++++++
 tests/qemuxml2argvtest.c                                   |  1 +
 4 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-net-default.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-net-default.xml

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0a9ed6b..4c5b3ec 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1195,7 +1195,8 @@ qemuDomainDefPostParse(virDomainDefPtr def,
 static const char *
 qemuDomainDefaultNetModel(const virDomainDef *def)
 {
-    if (ARCH_IS_S390(def->os.arch))
+    if (ARCH_IS_S390(def->os.arch) ||
+        ARCH_IS_PPC64(def->os.arch))
         return "virtio";
 
     if (def->os.arch == VIR_ARCH_ARMV7L ||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-net-default.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-net-default.args
new file mode 100644
index 0000000..50adffa
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-net-default.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-ppc64 -S -M pseries -m 512 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
+-device virtio-net-pci,vlan=0,id=net0,mac=52:54:00:55:2b:d9,bus=pci,addr=0x1 \
+-net user,vlan=0,name=hostnet0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-net-default.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-net-default.xml
new file mode 100644
index 0000000..7bf8139
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-net-default.xml
@@ -0,0 +1,14 @@
+<domain type='qemu'>
+  <name>pseries-net-default</name>
+  <memory unit='KiB'>524288</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc64' machine='pseries'>hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+    <interface type='user'>
+        <mac address='52:54:00:55:2b:d9'/>
+    </interface>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index c2482e6..f20a94b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1397,6 +1397,7 @@ mymain(void)
             QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
             QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_PIIX3_USB_UHCI,
             QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION);
+    DO_TEST("pseries-net-default", QEMU_CAPS_DEVICE);
     DO_TEST("pseries-vio-user-assigned", QEMU_CAPS_DRIVE,
             QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
     DO_TEST_ERROR("pseries-vio-address-clash", QEMU_CAPS_DRIVE,
-- 
2.4.3




More information about the libvir-list mailing list