Change in vdsm[master]: net: Update mtu under the bridge only when needed
edwardh at redhat.com
edwardh at redhat.com
Mon Dec 21 09:52:42 UTC 2015
Edward Haas has uploaded a new change for review.
Change subject: net: Update mtu under the bridge only when needed
......................................................................
net: Update mtu under the bridge only when needed
Updating the mtu of an existing bridge and its ports,
only when the mtu is different from the current value.
Change-Id: I0f26d1d6ddbb5ed1e7ecb4f6d7df1c185bccecc0
Signed-off-by: Edward Haas <edwardh at redhat.com>
---
M lib/vdsm/network/api.py
1 file changed, 16 insertions(+), 14 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/50790/1
diff --git a/lib/vdsm/network/api.py b/lib/vdsm/network/api.py
index f5d5cb1..93c55d2 100755
--- a/lib/vdsm/network/api.py
+++ b/lib/vdsm/network/api.py
@@ -35,10 +35,9 @@
from vdsm import kernelconfig
from vdsm import netconfpersistence
from vdsm.netinfo import (addresses, libvirtNets2vdsm, bridges,
- get as netinfo_get, CachingNetInfo,
+ get as netinfo_get, CachingNetInfo, mtus,
networks as netinfo_networks, nics as netinfo_nics,
NET_PATH)
-from vdsm.netinfo.mtus import DEFAULT_MTU
from vdsm import udevadm
from vdsm import utils
from vdsm import ipwrapper
@@ -319,18 +318,15 @@
_netinfo=_netinfo, configurator=configurator, opts=options)
if bridged and network in _netinfo.bridges:
- net_ent_to_configure = net_ent.port
+ # The bridge already exists, update the configured entity to one level
+ # down and update the mtu of the bridge.
+ # The mtu is updated in the bridge configuration and in all the tap
+ # devices attached to it (for the VMs).
+ # (expecting the bridge running mtu to be updated by the kernel when
+ # the device attached under it has its mtu updated)
logging.info("Bridge %s already exists.", network)
-
- # TODO: Update the mtu only if it is different from current.
-
- # The bridge already exists and we attach a new underlying device
- # to it. We need to make sure that the bridge MTU configuration is
- # updated.
- configurator.configApplier.setIfaceMtu(network, mtu)
- # We must also update the vms` tap devices (the bridge ports in
- # this case) so that their MTU is synced with the bridge
- _update_bridge_ports_mtu(net_ent.name, mtu)
+ net_ent_to_configure = net_ent.port
+ _update_mtu_for_an_existing_bridge(network, configurator, mtu)
else:
net_ent_to_configure = net_ent
@@ -340,6 +336,12 @@
configurator.configureLibvirtNetwork(network, net_ent)
if hostQos is not None:
configurator.configureQoS(hostQos, net_ent)
+
+
+def _update_mtu_for_an_existing_bridge(dev_name, configurator, mtu):
+ if mtu != mtus.getMtu(dev_name):
+ configurator.configApplier.setIfaceMtu(dev_name, mtu)
+ _update_bridge_ports_mtu(dev_name, mtu)
def assertBridgeClean(bridge, vlan, bonding, nics):
@@ -977,7 +979,7 @@
continue
if 'mtu' not in attrs:
- attrs['mtu'] = DEFAULT_MTU
+ attrs['mtu'] = mtus.DEFAULT_MTU
def setSafeNetworkConfig():
--
To view, visit https://gerrit.ovirt.org/50790
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f26d1d6ddbb5ed1e7ecb4f6d7df1c185bccecc0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Edward Haas <edwardh at redhat.com>
More information about the vdsm-patches
mailing list