Petr Horáček has uploaded a new change for review.

Change subject: hooks: ovs: set OVS devices UP
......................................................................

hooks: ovs: set OVS devices UP

Set all attached and created devices explicitly UP.

Change-Id: Ia8af77c136a8f27d980f94647f78570b3da1e611
Signed-off-by: Petr Horáček <phora...@redhat.com>
---
M vdsm_hooks/ovs/ovs_before_network_setup.py
1 file changed, 18 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/48388/1

diff --git a/vdsm_hooks/ovs/ovs_before_network_setup.py 
b/vdsm_hooks/ovs/ovs_before_network_setup.py
index 2f4523e..4cd3e35 100755
--- a/vdsm_hooks/ovs/ovs_before_network_setup.py
+++ b/vdsm_hooks/ovs/ovs_before_network_setup.py
@@ -32,13 +32,14 @@
 from libvirt import libvirtError
 import six
 
+from vdsm.ipwrapper import linkSet
 from vdsm.netconfpersistence import RunningConfig
 
 from hooking import execCmd
 import hooking
 
 from ovs_utils import (is_ovs_network, is_ovs_bond, iter_ovs_nets, suppress,
-                       destroy_ovs_bridge, EXT_IP, EXT_OVS_VSCTL,
+                       destroy_ovs_bridge, EXT_IP, EXT_OVS_VSCTL, BRIDGE_NAME,
                        INIT_CONFIG_FILE)
 from ovs_setup_ovs import configure_ovs, prepare_ovs
 from ovs_setup_ip import configure_ip
@@ -130,6 +131,21 @@
                    running_config, save_init_config=False)
 
 
+def _set_devices_up(nets, bonds):
+    devices = {BRIDGE_NAME}
+    for net, attrs in six.iter_items(nets):
+        if 'vlan' in attrs:
+            devices.add(net)
+        if 'nic' in attrs or 'bond' in attrs:
+            devices.add(attrs.get('nic') or attrs.get('bond'))
+    for bond, attrs in six.iter_items(bonds):
+        devices.add(bond)
+        devices.update(attrs['nics'])
+    for device in devices:
+        # NOTE: this could be async?
+        linkSet(device, ['up'])
+
+
 def _configure(nets, bonds, running_config, save_init_config=True):
     initial_config = deepcopy(running_config)
 
@@ -145,6 +161,7 @@
     configure_ovs(commands, running_config)
     configure_mtu(running_config)
     configure_ip(nets, initial_config.networks)
+    _set_devices_up(nets, bonds)
 
     log('Saving running configuration: %s %s' % (running_config.networks,
                                                  running_config.bonds))


-- 
To view, visit https://gerrit.ovirt.org/48388
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8af77c136a8f27d980f94647f78570b3da1e611
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phora...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to