From fa51e57bede51900e107daf7436f1f1f3c620df3 Mon Sep 17 00:00:00 2001 From: liyuenan Date: Fri, 24 Mar 2017 11:03:57 +0800 Subject: 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 --- .../roles/setup-network/files/setup_networks/setup_networks.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'deploy/adapters/ansible') 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) -- cgit 1.2.3-korg