1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
| | It is possible that the switch is already configured by external tools.
Do not error out when that is the case.
Submitted upstream: <https://github.com/ganeti/ganeti/pull/1495>.
diff --git a/lib/backend.py b/lib/backend.py
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -5865,14 +5865,14 @@ def ConfigureOVS(ovs_name, ovs_link):
"""
# Initialize the OpenvSwitch
- result = utils.RunCmd(["ovs-vsctl", "add-br", ovs_name])
+ result = utils.RunCmd(["ovs-vsctl", "--may-exist", "add-br", ovs_name])
if result.failed:
_Fail("Failed to create openvswitch. Script return value: %s, output: '%s'"
% (result.exit_code, result.output), log=True)
# And connect it to a physical interface, if given
if ovs_link:
- result = utils.RunCmd(["ovs-vsctl", "add-port", ovs_name, ovs_link])
+ result = utils.RunCmd(["ovs-vsctl", "--may-exist", "add-port", ovs_name, ovs_link])
if result.failed:
_Fail("Failed to connect openvswitch to interface %s. Script return"
" value: %s, output: '%s'" % (ovs_link, result.exit_code,
|