From 306b412857870d1952850b511011909066089af7 Mon Sep 17 00:00:00 2001 From: Jim Fehlig Date: Mon, 15 May 2017 09:47:39 -0600 Subject: [PATCH] Revert "qemu: propagate bridge MTU into qemu "host_mtu" option" This reverts commit 2841e6756d5807a4119e004bc5fb8e7d70806458. The change causes a guest ABI change. See following bugs for details https://bugzilla.suse.com/show_bug.cgi?id=1037774 https://bugzilla.redhat.com/show_bug.cgi?id=1449346 Signed-off-by: Jim Fehlig --- src/qemu/qemu_command.c | 32 ++++++++++---------------------- src/qemu/qemu_command.h | 3 +-- src/qemu/qemu_hotplug.c | 5 ++--- src/qemu/qemu_interface.c | 5 ++--- src/qemu/qemu_interface.h | 3 +-- 5 files changed, 16 insertions(+), 32 deletions(-) Index: libvirt-3.3.0/src/qemu/qemu_command.c =================================================================== --- libvirt-3.3.0.orig/src/qemu/qemu_command.c +++ libvirt-3.3.0/src/qemu/qemu_command.c @@ -3633,8 +3633,7 @@ qemuBuildNicDevStr(virDomainDefPtr def, int vlan, unsigned int bootindex, size_t vhostfdSize, - virQEMUCapsPtr qemuCaps, - unsigned int mtu) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; const char *nic = net->model; @@ -3758,23 +3757,13 @@ qemuBuildNicDevStr(virDomainDefPtr def, virBufferAsprintf(&buf, ",rx_queue_size=%u", net->driver.virtio.rx_queue_size); } - if (usingVirtio && mtu) { - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) { - - virBufferAsprintf(&buf, ",host_mtu=%u", mtu); - - } else { - /* log an error if mtu was requested specifically for this - * interface, otherwise, if it's just what was reported by - * the attached network, ignore it. - */ - if (net->mtu) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("setting MTU is not supported with " - "this QEMU binary")); - goto error; - } + if (usingVirtio && net->mtu) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("setting MTU is not supported with this QEMU binary")); + goto error; } + virBufferAsprintf(&buf, ",host_mtu=%u", net->mtu); } if (vlan == -1) @@ -8320,7 +8309,7 @@ qemuBuildVhostuserCommandLine(virQEMUDri VIR_FREE(netdev); if (!(nic = qemuBuildNicDevStr(def, net, -1, bootindex, - queues, qemuCaps, net->mtu))) { + queues, qemuCaps))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Error generating NIC -device string")); goto error; @@ -8366,7 +8355,6 @@ qemuBuildInterfaceCommandLine(virQEMUDri virDomainNetType actualType = virDomainNetGetActualType(net); virNetDevBandwidthPtr actualBandwidth; size_t i; - unsigned int mtu = net->mtu; if (!bootindex) @@ -8421,7 +8409,7 @@ qemuBuildInterfaceCommandLine(virQEMUDri memset(tapfd, -1, tapfdSize * sizeof(tapfd[0])); if (qemuInterfaceBridgeConnect(def, driver, net, - tapfd, &tapfdSize, &mtu) < 0) + tapfd, &tapfdSize) < 0) goto cleanup; break; @@ -8601,7 +8589,7 @@ qemuBuildInterfaceCommandLine(virQEMUDri } if (qemuDomainSupportsNicdev(def, net)) { if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex, - vhostfdSize, qemuCaps, mtu))) + vhostfdSize, qemuCaps))) goto cleanup; virCommandAddArgList(cmd, "-device", nic, NULL); } else { Index: libvirt-3.3.0/src/qemu/qemu_command.h =================================================================== --- libvirt-3.3.0.orig/src/qemu/qemu_command.h +++ libvirt-3.3.0/src/qemu/qemu_command.h @@ -101,8 +101,7 @@ char *qemuBuildNicDevStr(virDomainDefPtr int vlan, unsigned int bootindex, size_t vhostfdSize, - virQEMUCapsPtr qemuCaps, - unsigned int mtu); + virQEMUCapsPtr qemuCaps); char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk); Index: libvirt-3.3.0/src/qemu/qemu_hotplug.c =================================================================== --- libvirt-3.3.0.orig/src/qemu/qemu_hotplug.c +++ libvirt-3.3.0/src/qemu/qemu_hotplug.c @@ -968,7 +968,6 @@ qemuDomainAttachNetDevice(virQEMUDriverP bool charDevPlugged = false; bool netdevPlugged = false; bool hostPlugged = false; - unsigned int mtu = net->mtu; /* preallocate new slot for device */ if (VIR_REALLOC_N(vm->def->nets, vm->def->nnets + 1) < 0) @@ -1025,7 +1024,7 @@ qemuDomainAttachNetDevice(virQEMUDriverP goto cleanup; memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize); if (qemuInterfaceBridgeConnect(vm->def, driver, net, - tapfd, &tapfdSize, &mtu) < 0) + tapfd, &tapfdSize) < 0) goto cleanup; iface_connected = true; if (qemuInterfaceOpenVhostNet(vm->def, net, priv->qemuCaps, @@ -1239,7 +1238,7 @@ qemuDomainAttachNetDevice(virQEMUDriverP VIR_FORCE_CLOSE(vhostfd[i]); if (!(nicstr = qemuBuildNicDevStr(vm->def, net, vlan, 0, - queueSize, priv->qemuCaps, mtu))) + queueSize, priv->qemuCaps))) goto try_remove; qemuDomainObjEnterMonitor(driver, vm); Index: libvirt-3.3.0/src/qemu/qemu_interface.c =================================================================== --- libvirt-3.3.0.orig/src/qemu/qemu_interface.c +++ libvirt-3.3.0/src/qemu/qemu_interface.c @@ -503,8 +503,7 @@ qemuInterfaceBridgeConnect(virDomainDefP virQEMUDriverPtr driver, virDomainNetDefPtr net, int *tapfd, - size_t *tapfdSize, - unsigned int *mtu) + size_t *tapfdSize) { const char *brname; int ret = -1; @@ -545,7 +544,7 @@ qemuInterfaceBridgeConnect(virDomainDefP def->uuid, tunpath, tapfd, *tapfdSize, virDomainNetGetActualVirtPortProfile(net), virDomainNetGetActualVlan(net), - net->coalesce, net->mtu, mtu, + NULL, 0, NULL, tap_create_flags) < 0) { virDomainAuditNetDevice(def, net, tunpath, false); goto cleanup; Index: libvirt-3.3.0/src/qemu/qemu_interface.h =================================================================== --- libvirt-3.3.0.orig/src/qemu/qemu_interface.h +++ libvirt-3.3.0/src/qemu/qemu_interface.h @@ -51,8 +51,7 @@ int qemuInterfaceBridgeConnect(virDomain virQEMUDriverPtr driver, virDomainNetDefPtr net, int *tapfd, - size_t *tapfdSize, - unsigned int *mtu) + size_t *tapfdSize) ATTRIBUTE_NONNULL(2); int qemuInterfaceOpenVhostNet(virDomainDefPtr def,