summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/setup-network
diff options
context:
space:
mode:
authorliyuenan <liyuenan@huawei.com>2017-03-24 11:03:57 +0800
committerliyuenan <liyuenan@huawei.com>2017-03-24 14:38:56 +0800
commitfa51e57bede51900e107daf7436f1f1f3c620df3 (patch)
treeaa3333c6ea34586d3c0ac46d278c1f784fda1ce4 /deploy/adapters/ansible/roles/setup-network
parent366a89b97863c820a063b62609fa88142550a2f5 (diff)
Support compute node restart on CentOS
JIRA: - Openvswitch service in Ubuntu named openvswitch-switch, but it named openvswitch in CentOS. Change-Id: I2a4d3d0ae0a646971696bae798b623da059a3781 Signed-off-by: liyuenan <liyuenan@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/setup-network')
-rw-r--r--deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py b/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
index ab13e088..64c0469e 100644
--- a/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
+++ b/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
@@ -10,6 +10,8 @@
import yaml
import netaddr
import os
+import platform
+import re
import log as logging
LOG = logging.getLogger("net-init")
@@ -88,6 +90,11 @@ def main(config):
setup_ips(config["ip_settings"], config["sys_intf_mappings"])
if __name__ == "__main__":
- os.system("service openvswitch-switch status|| service openvswitch-switch start") # noqa
+ if re.search('Ubuntu', platform.platform()):
+ os.system("service openvswitch-switch start")
+ elif re.search('redhat|centos', platform.platform()):
+ os.system("service openvswitch start")
+ else:
+ os.system("echo 'ERROR: no service named openvswitch'")
config = yaml.load(open(config_path))
main(config)