aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author“Manuel Buil” <mbuil@suse.com>2017-02-03 17:34:45 +0100
committer“Manuel Buil” <mbuil@suse.com>2017-02-03 17:34:45 +0100
commit18495bdb327798206c8aaf099f48e8f8831be32e (patch)
tree58d485c7dbe6c8da24ba52ef512eb6de5c808681
parent58c118253a081f19a8a14a0a16895b04c6b8f222 (diff)
Bug fix: prepare all computes not only one
JIRA:SFC-71 Not all compute nodes were prepared with the right config to run SFC-NSH Change-Id: I3187020daecf0a90e5f7314dea3fefbf8fe470be Signed-off-by: “Manuel Buil” <mbuil@suse.com>
-rw-r--r--sfc/lib/utils.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py
index f4412abf..13f534be 100644
--- a/sfc/lib/utils.py
+++ b/sfc/lib/utils.py
@@ -60,13 +60,9 @@ def run_cmd_on_controller(cmd):
return run_cmd_on_fm(ssh_cmd)
-def run_cmd_on_compute(cmd):
+def run_cmd_on_compute(cmd, ip_compute):
"""run given command on OpenStack Compute node"""
- ip_computes = get_openstack_node_ips("compute")
- if not ip_computes:
- return None
-
- ssh_cmd = "ssh %s %s %s" % (SSH_OPTIONS, ip_computes[0], cmd)
+ ssh_cmd = "ssh %s %s %s" % (SSH_OPTIONS, ip_compute, cmd)
return run_cmd_on_fm(ssh_cmd)
@@ -391,9 +387,12 @@ def wait_for_classification_rules(ovs_logger, compute_clients, timeout=200):
def setup_compute_node(cidr):
logger.info("bringing up br-int iface")
- run_cmd_on_compute("ifconfig br-int up")
- if not run_cmd_on_compute("ip route|grep -o %s" % cidr):
- logger.info("adding route %s" % cidr)
- return run_cmd_on_compute("ip route add %s" % cidr)
- else:
- logger.info("route %s exists" % cidr)
+ # TODO: Get only the compute nodes which belong to the env.
+ ip_computes = get_openstack_node_ips("compute")
+ for ip_compute in ip_computes:
+ run_cmd_on_compute("ifconfig br-int up", ip_compute)
+ if not run_cmd_on_compute("ip route|grep -o %s" % cidr, ip_compute):
+ logger.info("adding route %s in %s" % (cidr, ip_compute))
+ run_cmd_on_compute("ip route add %s" % cidr, ip_compute)
+ else:
+ logger.info("route %s exists" % cidr)