From 18495bdb327798206c8aaf099f48e8f8831be32e Mon Sep 17 00:00:00 2001 From: “Manuel Buil” Date: Fri, 3 Feb 2017 17:34:45 +0100 Subject: Bug fix: prepare all computes not only one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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” --- sfc/lib/utils.py | 23 +++++++++++------------ 1 file 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) -- cgit 1.2.3-korg