|
|
c8c376 |
From 62821d2db6a1d60bc00c22d4da021999772bd2e4 Mon Sep 17 00:00:00 2001
|
|
|
c8c376 |
Message-Id: <62821d2db6a1d60bc00c22d4da021999772bd2e4@dist-git>
|
|
|
c8c376 |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
c8c376 |
Date: Tue, 8 Nov 2016 13:42:03 +0100
|
|
|
c8c376 |
Subject: [PATCH] qemuBuildInterfaceCommandLine: Move hostdev handling a bit
|
|
|
c8c376 |
further
|
|
|
c8c376 |
|
|
|
c8c376 |
RHEL-7.3: https://bugzilla.redhat.com/show_bug.cgi?id=1366108
|
|
|
c8c376 |
RHEL-7.3.z: https://bugzilla.redhat.com/show_bug.cgi?id=1392032
|
|
|
c8c376 |
|
|
|
c8c376 |
The idea is to have function that does some checking of the
|
|
|
c8c376 |
arguments at its beginning and then have one big switch for all
|
|
|
c8c376 |
the interface types it supports. Each one of them generating the
|
|
|
c8c376 |
corresponding part of the command line.
|
|
|
c8c376 |
|
|
|
c8c376 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
c8c376 |
(cherry picked from commit ec7f612a56ed8d3a2e83101b5cffcea3058fd30a)
|
|
|
c8c376 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
c8c376 |
---
|
|
|
c8c376 |
src/qemu/qemu_command.c | 13 ++++----
|
|
|
c8c376 |
.../qemuxml2argv-net-hostdev-fail.xml | 39 ++++++++++++++++++++++
|
|
|
c8c376 |
tests/qemuxml2argvtest.c | 4 +++
|
|
|
c8c376 |
3 files changed, 49 insertions(+), 7 deletions(-)
|
|
|
c8c376 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-hostdev-fail.xml
|
|
|
c8c376 |
|
|
|
c8c376 |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
c8c376 |
index 8d002ffb2..1e7d9209a 100644
|
|
|
c8c376 |
--- a/src/qemu/qemu_command.c
|
|
|
c8c376 |
+++ b/src/qemu/qemu_command.c
|
|
|
c8c376 |
@@ -8007,13 +8007,6 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
|
|
c8c376 |
if (actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER)
|
|
|
c8c376 |
return qemuBuildVhostuserCommandLine(cmd, def, net, qemuCaps, bootindex);
|
|
|
c8c376 |
|
|
|
c8c376 |
- if (actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
|
|
|
c8c376 |
- /* NET_TYPE_HOSTDEV devices are really hostdev devices, so
|
|
|
c8c376 |
- * their commandlines are constructed with other hostdevs.
|
|
|
c8c376 |
- */
|
|
|
c8c376 |
- return 0;
|
|
|
c8c376 |
- }
|
|
|
c8c376 |
-
|
|
|
c8c376 |
/* Currently nothing besides TAP devices supports multiqueue. */
|
|
|
c8c376 |
if (net->driver.virtio.queues > 0 &&
|
|
|
c8c376 |
!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
|
|
|
c8c376 |
@@ -8093,6 +8086,12 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
|
|
c8c376 |
if (qemuInterfaceEthernetConnect(def, driver, net,
|
|
|
c8c376 |
tapfd, tapfdSize) < 0)
|
|
|
c8c376 |
goto cleanup;
|
|
|
c8c376 |
+ } else if (actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
|
|
|
c8c376 |
+ /* NET_TYPE_HOSTDEV devices are really hostdev devices, so
|
|
|
c8c376 |
+ * their commandlines are constructed with other hostdevs.
|
|
|
c8c376 |
+ */
|
|
|
c8c376 |
+ ret = 0;
|
|
|
c8c376 |
+ goto cleanup;
|
|
|
c8c376 |
}
|
|
|
c8c376 |
|
|
|
c8c376 |
/* For types whose implementations use a netdev on the host, add
|
|
|
c8c376 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-hostdev-fail.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-hostdev-fail.xml
|
|
|
c8c376 |
new file mode 100644
|
|
|
c8c376 |
index 000000000..7807d793f
|
|
|
c8c376 |
--- /dev/null
|
|
|
c8c376 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-hostdev-fail.xml
|
|
|
c8c376 |
@@ -0,0 +1,39 @@
|
|
|
c8c376 |
+<domain type='qemu'>
|
|
|
c8c376 |
+ <name>QEMUGuest1</name>
|
|
|
c8c376 |
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
|
|
c8c376 |
+ <memory unit='KiB'>219136</memory>
|
|
|
c8c376 |
+ <currentMemory unit='KiB'>219136</currentMemory>
|
|
|
c8c376 |
+ <vcpu placement='static'>1</vcpu>
|
|
|
c8c376 |
+ <os>
|
|
|
c8c376 |
+ <type arch='i686' machine='pc'>hvm</type>
|
|
|
c8c376 |
+ <boot dev='hd'/>
|
|
|
c8c376 |
+ </os>
|
|
|
c8c376 |
+ <clock offset='utc'/>
|
|
|
c8c376 |
+ <on_poweroff>destroy</on_poweroff>
|
|
|
c8c376 |
+ <on_reboot>restart</on_reboot>
|
|
|
c8c376 |
+ <on_crash>destroy</on_crash>
|
|
|
c8c376 |
+ <devices>
|
|
|
c8c376 |
+ <emulator>/usr/bin/qemu</emulator>
|
|
|
c8c376 |
+ <disk type='block' device='disk'>
|
|
|
c8c376 |
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
|
|
c8c376 |
+ <target dev='hda' bus='ide'/>
|
|
|
c8c376 |
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
|
|
c8c376 |
+ </disk>
|
|
|
c8c376 |
+ <controller type='usb' index='0'/>
|
|
|
c8c376 |
+ <controller type='ide' index='0'/>
|
|
|
c8c376 |
+ <controller type='pci' index='0' model='pci-root'/>
|
|
|
c8c376 |
+ <interface type='hostdev' managed='yes'>
|
|
|
c8c376 |
+ <mac address='00:11:22:33:44:55'/>
|
|
|
c8c376 |
+ <source>
|
|
|
c8c376 |
+ <address type='pci' domain='0x0000' bus='0x03' slot='0x07' function='0x1'/>
|
|
|
c8c376 |
+ </source>
|
|
|
c8c376 |
+ <model type='virtio'/>
|
|
|
c8c376 |
+ <filterref filter='myfilter'/>
|
|
|
c8c376 |
+ <backend tap='/dev/mytap'/>
|
|
|
c8c376 |
+ <driver queues='4'/>
|
|
|
c8c376 |
+ </interface>
|
|
|
c8c376 |
+ <input type='mouse' bus='ps2'/>
|
|
|
c8c376 |
+ <input type='keyboard' bus='ps2'/>
|
|
|
c8c376 |
+ <memballoon model='virtio'/>
|
|
|
c8c376 |
+ </devices>
|
|
|
c8c376 |
+</domain>
|
|
|
c8c376 |
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
|
|
c8c376 |
index 7ae7f5d66..d84c148df 100644
|
|
|
c8c376 |
--- a/tests/qemuxml2argvtest.c
|
|
|
c8c376 |
+++ b/tests/qemuxml2argvtest.c
|
|
|
c8c376 |
@@ -1065,6 +1065,10 @@ mymain(void)
|
|
|
c8c376 |
QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
|
|
|
c8c376 |
DO_TEST_FAILURE("net-hostdev-vfio-multidomain",
|
|
|
c8c376 |
QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VFIO_PCI);
|
|
|
c8c376 |
+ DO_TEST_FAILURE("net-hostdev-fail",
|
|
|
c8c376 |
+ QEMU_CAPS_NODEFCONFIG,
|
|
|
c8c376 |
+ QEMU_CAPS_DEVICE_VFIO_PCI);
|
|
|
c8c376 |
+
|
|
|
c8c376 |
|
|
|
c8c376 |
DO_TEST("serial-vc", NONE);
|
|
|
c8c376 |
DO_TEST("serial-pty", NONE);
|
|
|
c8c376 |
--
|
|
|
c8c376 |
2.11.0
|
|
|
c8c376 |
|