diff options
author | Manuel Buil <mbuil@suse.com> | 2017-02-03 17:35:57 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-02-03 17:35:57 +0000 |
commit | b271d9361b4f534113f59c17dd28b088c121189c (patch) | |
tree | bab0ceb4a678b3b493b6273fbbadcf6381596d84 | |
parent | 1cb4ff63f40da33e0d7ba110b70d4ed0011b03bd (diff) | |
parent | 18495bdb327798206c8aaf099f48e8f8831be32e (diff) |
Merge "Bug fix: prepare all computes not only one"
-rw-r--r-- | sfc/lib/utils.py | 23 |
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) |