libvirt: add qemu version check when configuring mtu for network

This adds a QEMU check when configuring MTU for ethernet and bridge
interface types. When creating and configuring tap devices, libvirt is
setting MTU but also configures the virtio-net devices to let it
discovers the MTU used. This QEMU 'host_mtu' option is supported by
QEMU version 2.9 and more.

Closes-Bug: 1779626
Change-Id: I55cf259c715ba129fa8479d1e8a0d11ec15aaa43
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@redhat.com>
This commit is contained in:
Sahid Orentino Ferdjaoui 2018-07-02 17:42:05 +02:00
parent 0ef62de888
commit e2d7189f4f
1 changed files with 6 additions and 2 deletions

View File

@ -51,8 +51,11 @@ CONF = nova.conf.CONF
MIN_LIBVIRT_VHOSTUSER_MQ = (1, 2, 17)
# vlan tag for macvtap passthrough mode on SRIOV VFs
MIN_LIBVIRT_MACVTAP_PASSTHROUGH_VLAN = (1, 3, 5)
# setting interface mtu was intoduced in libvirt 3.3
# setting interface mtu was intoduced in libvirt 3.3, We also need to
# check for QEMU that because libvirt is configuring in same time
# host_mtu for virtio-net, fails if not supported.
MIN_LIBVIRT_INTERFACE_MTU = (3, 3, 0)
MIN_QEMU_INTERFACE_MTU = (2, 9, 0)
# virtio-net.rx_queue_size support
MIN_LIBVIRT_RX_QUEUE_SIZE = (2, 3, 0)
@ -276,7 +279,8 @@ class LibvirtGenericVIFDriver(object):
designer.set_vif_mtu_config(conf, network.get_meta("mtu"))
def _has_min_version_for_mtu(self, host):
return host.has_min_version(MIN_LIBVIRT_INTERFACE_MTU)
return host.has_min_version(MIN_LIBVIRT_INTERFACE_MTU,
MIN_QEMU_INTERFACE_MTU)
def get_config_802qbg(self, instance, vif, image_meta,
inst_type, virt_type, host):