|
|
6d3351 |
From b36260c361f9d8a854c4d5e9c7309aed7cb99834 Mon Sep 17 00:00:00 2001
|
|
|
6d3351 |
Message-Id: <b36260c361f9d8a854c4d5e9c7309aed7cb99834@dist-git>
|
|
|
6d3351 |
From: Laine Stump <laine@laine.org>
|
|
|
6d3351 |
Date: Tue, 23 May 2017 13:02:42 -0400
|
|
|
6d3351 |
Subject: [PATCH] Revert "qemu: propagate bridge MTU into qemu "host_mtu"
|
|
|
6d3351 |
option"
|
|
|
6d3351 |
|
|
|
6d3351 |
This reverts commit 2841e675.
|
|
|
6d3351 |
|
|
|
6d3351 |
It turns out that adding the host_mtu field to the PCI capabilities in
|
|
|
6d3351 |
the guest bumps the length of PCI capabilities beyond the 32 byte
|
|
|
6d3351 |
boundary, so the virtio-net device gets 64 bytes of ioport space
|
|
|
6d3351 |
instead of 32, which offsets the address of all the other following
|
|
|
6d3351 |
devices. Migration doesn't work very well when the location and length
|
|
|
6d3351 |
of PCI capabilities of devices is changed between source and
|
|
|
6d3351 |
destination.
|
|
|
6d3351 |
|
|
|
6d3351 |
This means that we need to make sure that the absence/presence of
|
|
|
6d3351 |
host_mtu on the qemu commandline always matches between source and
|
|
|
6d3351 |
destination, which means that we need to make setting of host_mtu an
|
|
|
6d3351 |
opt-in thing (it can't happen automatically when the bridge being used
|
|
|
6d3351 |
has a non-default MTU, which is what commit 2841e675 implemented).
|
|
|
6d3351 |
|
|
|
6d3351 |
I do want to re-implement this feature with an <mtu auto='on'/>
|
|
|
6d3351 |
setting, but probably won't backport that to any stable branches, so
|
|
|
6d3351 |
I'm first reverting the original commit, and that revert can be pushed
|
|
|
6d3351 |
to the few releases that have been made since the original (3.1.0 -
|
|
|
6d3351 |
3.3.0)
|
|
|
6d3351 |
|
|
|
6d3351 |
Resolves: https://bugzilla.redhat.com/1449346
|
|
|
6d3351 |
(cherry picked from commit 77780a29edace958a1f931d3281b962be4f5290e)
|
|
|
6d3351 |
|
|
|
6d3351 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6d3351 |
---
|
|
|
6d3351 |
src/qemu/qemu_command.c | 32 ++++++++++----------------------
|
|
|
6d3351 |
src/qemu/qemu_command.h | 3 +--
|
|
|
6d3351 |
src/qemu/qemu_hotplug.c | 5 ++---
|
|
|
6d3351 |
src/qemu/qemu_interface.c | 5 ++---
|
|
|
6d3351 |
src/qemu/qemu_interface.h | 3 +--
|
|
|
6d3351 |
5 files changed, 16 insertions(+), 32 deletions(-)
|
|
|
6d3351 |
|
|
|
6d3351 |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
6d3351 |
index 30feef1de..4d3a3d8ca 100644
|
|
|
6d3351 |
--- a/src/qemu/qemu_command.c
|
|
|
6d3351 |
+++ b/src/qemu/qemu_command.c
|
|
|
6d3351 |
@@ -3633,8 +3633,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
|
|
|
6d3351 |
int vlan,
|
|
|
6d3351 |
unsigned int bootindex,
|
|
|
6d3351 |
size_t vhostfdSize,
|
|
|
6d3351 |
- virQEMUCapsPtr qemuCaps,
|
|
|
6d3351 |
- unsigned int mtu)
|
|
|
6d3351 |
+ virQEMUCapsPtr qemuCaps)
|
|
|
6d3351 |
{
|
|
|
6d3351 |
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
|
|
6d3351 |
const char *nic = net->model;
|
|
|
6d3351 |
@@ -3758,23 +3757,13 @@ qemuBuildNicDevStr(virDomainDefPtr def,
|
|
|
6d3351 |
virBufferAsprintf(&buf, ",rx_queue_size=%u", net->driver.virtio.rx_queue_size);
|
|
|
6d3351 |
}
|
|
|
6d3351 |
|
|
|
6d3351 |
- if (usingVirtio && mtu) {
|
|
|
6d3351 |
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) {
|
|
|
6d3351 |
-
|
|
|
6d3351 |
- virBufferAsprintf(&buf, ",host_mtu=%u", mtu);
|
|
|
6d3351 |
-
|
|
|
6d3351 |
- } else {
|
|
|
6d3351 |
- /* log an error if mtu was requested specifically for this
|
|
|
6d3351 |
- * interface, otherwise, if it's just what was reported by
|
|
|
6d3351 |
- * the attached network, ignore it.
|
|
|
6d3351 |
- */
|
|
|
6d3351 |
- if (net->mtu) {
|
|
|
6d3351 |
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
6d3351 |
- _("setting MTU is not supported with "
|
|
|
6d3351 |
- "this QEMU binary"));
|
|
|
6d3351 |
- goto error;
|
|
|
6d3351 |
- }
|
|
|
6d3351 |
+ if (usingVirtio && net->mtu) {
|
|
|
6d3351 |
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) {
|
|
|
6d3351 |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
6d3351 |
+ _("setting MTU is not supported with this QEMU binary"));
|
|
|
6d3351 |
+ goto error;
|
|
|
6d3351 |
}
|
|
|
6d3351 |
+ virBufferAsprintf(&buf, ",host_mtu=%u", net->mtu);
|
|
|
6d3351 |
}
|
|
|
6d3351 |
|
|
|
6d3351 |
if (vlan == -1)
|
|
|
6d3351 |
@@ -8275,7 +8264,7 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver,
|
|
|
6d3351 |
VIR_FREE(netdev);
|
|
|
6d3351 |
|
|
|
6d3351 |
if (!(nic = qemuBuildNicDevStr(def, net, -1, bootindex,
|
|
|
6d3351 |
- queues, qemuCaps, net->mtu))) {
|
|
|
6d3351 |
+ queues, qemuCaps))) {
|
|
|
6d3351 |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
6d3351 |
"%s", _("Error generating NIC -device string"));
|
|
|
6d3351 |
goto error;
|
|
|
6d3351 |
@@ -8321,7 +8310,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
|
|
|
6d3351 |
virDomainNetType actualType = virDomainNetGetActualType(net);
|
|
|
6d3351 |
virNetDevBandwidthPtr actualBandwidth;
|
|
|
6d3351 |
size_t i;
|
|
|
6d3351 |
- unsigned int mtu = net->mtu;
|
|
|
6d3351 |
|
|
|
6d3351 |
|
|
|
6d3351 |
if (!bootindex)
|
|
|
6d3351 |
@@ -8376,7 +8364,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
|
|
|
6d3351 |
memset(tapfd, -1, tapfdSize * sizeof(tapfd[0]));
|
|
|
6d3351 |
|
|
|
6d3351 |
if (qemuInterfaceBridgeConnect(def, driver, net,
|
|
|
6d3351 |
- tapfd, &tapfdSize, &mtu) < 0)
|
|
|
6d3351 |
+ tapfd, &tapfdSize) < 0)
|
|
|
6d3351 |
goto cleanup;
|
|
|
6d3351 |
break;
|
|
|
6d3351 |
|
|
|
6d3351 |
@@ -8556,7 +8544,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
|
|
|
6d3351 |
}
|
|
|
6d3351 |
if (qemuDomainSupportsNicdev(def, net)) {
|
|
|
6d3351 |
if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
|
|
|
6d3351 |
- vhostfdSize, qemuCaps, mtu)))
|
|
|
6d3351 |
+ vhostfdSize, qemuCaps)))
|
|
|
6d3351 |
goto cleanup;
|
|
|
6d3351 |
virCommandAddArgList(cmd, "-device", nic, NULL);
|
|
|
6d3351 |
} else {
|
|
|
6d3351 |
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
|
|
|
6d3351 |
index 7da92c8c9..09cb00ee9 100644
|
|
|
6d3351 |
--- a/src/qemu/qemu_command.h
|
|
|
6d3351 |
+++ b/src/qemu/qemu_command.h
|
|
|
6d3351 |
@@ -101,8 +101,7 @@ char *qemuBuildNicDevStr(virDomainDefPtr def,
|
|
|
6d3351 |
int vlan,
|
|
|
6d3351 |
unsigned int bootindex,
|
|
|
6d3351 |
size_t vhostfdSize,
|
|
|
6d3351 |
- virQEMUCapsPtr qemuCaps,
|
|
|
6d3351 |
- unsigned int mtu);
|
|
|
6d3351 |
+ virQEMUCapsPtr qemuCaps);
|
|
|
6d3351 |
|
|
|
6d3351 |
char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk);
|
|
|
6d3351 |
|
|
|
6d3351 |
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
|
|
6d3351 |
index 5c3660922..cdeb0617a 100644
|
|
|
6d3351 |
--- a/src/qemu/qemu_hotplug.c
|
|
|
6d3351 |
+++ b/src/qemu/qemu_hotplug.c
|
|
|
6d3351 |
@@ -968,7 +968,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|
|
6d3351 |
bool charDevPlugged = false;
|
|
|
6d3351 |
bool netdevPlugged = false;
|
|
|
6d3351 |
bool hostPlugged = false;
|
|
|
6d3351 |
- unsigned int mtu = net->mtu;
|
|
|
6d3351 |
|
|
|
6d3351 |
/* preallocate new slot for device */
|
|
|
6d3351 |
if (VIR_REALLOC_N(vm->def->nets, vm->def->nnets + 1) < 0)
|
|
|
6d3351 |
@@ -1025,7 +1024,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|
|
6d3351 |
goto cleanup;
|
|
|
6d3351 |
memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize);
|
|
|
6d3351 |
if (qemuInterfaceBridgeConnect(vm->def, driver, net,
|
|
|
6d3351 |
- tapfd, &tapfdSize, &mtu) < 0)
|
|
|
6d3351 |
+ tapfd, &tapfdSize) < 0)
|
|
|
6d3351 |
goto cleanup;
|
|
|
6d3351 |
iface_connected = true;
|
|
|
6d3351 |
if (qemuInterfaceOpenVhostNet(vm->def, net, priv->qemuCaps,
|
|
|
6d3351 |
@@ -1239,7 +1238,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|
|
6d3351 |
VIR_FORCE_CLOSE(vhostfd[i]);
|
|
|
6d3351 |
|
|
|
6d3351 |
if (!(nicstr = qemuBuildNicDevStr(vm->def, net, vlan, 0,
|
|
|
6d3351 |
- queueSize, priv->qemuCaps, mtu)))
|
|
|
6d3351 |
+ queueSize, priv->qemuCaps)))
|
|
|
6d3351 |
goto try_remove;
|
|
|
6d3351 |
|
|
|
6d3351 |
qemuDomainObjEnterMonitor(driver, vm);
|
|
|
6d3351 |
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
|
|
|
6d3351 |
index c643b76ec..e11d69c3e 100644
|
|
|
6d3351 |
--- a/src/qemu/qemu_interface.c
|
|
|
6d3351 |
+++ b/src/qemu/qemu_interface.c
|
|
|
6d3351 |
@@ -503,8 +503,7 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def,
|
|
|
6d3351 |
virQEMUDriverPtr driver,
|
|
|
6d3351 |
virDomainNetDefPtr net,
|
|
|
6d3351 |
int *tapfd,
|
|
|
6d3351 |
- size_t *tapfdSize,
|
|
|
6d3351 |
- unsigned int *mtu)
|
|
|
6d3351 |
+ size_t *tapfdSize)
|
|
|
6d3351 |
{
|
|
|
6d3351 |
const char *brname;
|
|
|
6d3351 |
int ret = -1;
|
|
|
6d3351 |
@@ -545,7 +544,7 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def,
|
|
|
6d3351 |
def->uuid, tunpath, tapfd, *tapfdSize,
|
|
|
6d3351 |
virDomainNetGetActualVirtPortProfile(net),
|
|
|
6d3351 |
virDomainNetGetActualVlan(net),
|
|
|
6d3351 |
- net->coalesce, net->mtu, mtu,
|
|
|
6d3351 |
+ net->coalesce, 0, NULL,
|
|
|
6d3351 |
tap_create_flags) < 0) {
|
|
|
6d3351 |
virDomainAuditNetDevice(def, net, tunpath, false);
|
|
|
6d3351 |
goto cleanup;
|
|
|
6d3351 |
diff --git a/src/qemu/qemu_interface.h b/src/qemu/qemu_interface.h
|
|
|
6d3351 |
index ba74ac2cf..a7faa0b3d 100644
|
|
|
6d3351 |
--- a/src/qemu/qemu_interface.h
|
|
|
6d3351 |
+++ b/src/qemu/qemu_interface.h
|
|
|
6d3351 |
@@ -51,8 +51,7 @@ int qemuInterfaceBridgeConnect(virDomainDefPtr def,
|
|
|
6d3351 |
virQEMUDriverPtr driver,
|
|
|
6d3351 |
virDomainNetDefPtr net,
|
|
|
6d3351 |
int *tapfd,
|
|
|
6d3351 |
- size_t *tapfdSize,
|
|
|
6d3351 |
- unsigned int *mtu)
|
|
|
6d3351 |
+ size_t *tapfdSize)
|
|
|
6d3351 |
ATTRIBUTE_NONNULL(2);
|
|
|
6d3351 |
|
|
|
6d3351 |
int qemuInterfaceOpenVhostNet(virDomainDefPtr def,
|
|
|
6d3351 |
--
|
|
|
6d3351 |
2.13.0
|
|
|
6d3351 |
|