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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 31, 2015 at 02:39:08PM +0200, Andrea Bolognani wrote:
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1254044
---

You could be a bit more expressive in the commit message, you know ;)

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";


So, we now use rtl8139 even if the emulator doesn't support it, but
with this we will use virtio as a default even if the emulator doesn't
support it.  Since we can now use qemu capabilities in parsing code,
why don't we utilize them here as well?  I would suggest you to leave
this condition alone and instead add a new one on top of that which
returns "virtio" whenever the emulator supports it.  That's sensible
default, doesn't break anything and we just didn't do that because
caps weren't available at that time.

    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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]