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>
(cherry picked from commit e2d7189f4f)
This commit is contained in:
Sahid Orentino Ferdjaoui 2018-07-02 17:42:05 +02:00 committed by Lee Yarwood
parent 127dd738c0
commit 509e0a0303
1 changed files with 6 additions and 2 deletions

View File

@ -48,8 +48,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)
def is_vif_model_valid_for_virt(virt_type, vif_model):
@ -254,7 +257,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_ivs_hybrid(self, instance, vif, image_meta,
inst_type, virt_type, host):