diff options
author | baigk <baiguoku@huawei.com> | 2015-09-23 14:23:44 +0800 |
---|---|---|
committer | baigk <baiguoku@huawei.com> | 2015-09-24 00:22:30 +0800 |
commit | 5dcc94014a588e6f7bb5cb605b164609ac0b50c7 (patch) | |
tree | 1027a92382ed4a3c96c0bb2ec84ec1fdfd8e8b93 /deploy/adapters/ansible/roles/setup-network | |
parent | 7d95e981d3685795620443083385e00ab1ccd3f0 (diff) |
bug fix: using external_vip as linked dashboard ip
JIRA: COMPASS-72
Change-Id: I9ab8f6042635a7a06f1a4e2fb3222f790a5bee76
Signed-off-by: baigk <baiguoku@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.py | 12 |
1 files changed, 8 insertions, 4 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 b46abcee..5e6520af 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 @@ -30,7 +30,8 @@ def add_ovs_port(ovs_br, ifname, vlan_id=None): cmd = "ovs-vsctl --may-exist add-port %s %s" % (ovs_br, ifname) if vlan_id: cmd += " tag=%s" % vlan_id - cmd += " -- set Interface %s type=internal" % ifname + cmd += " -- set Interface %s type=internal;" % ifname + cmd += "ip link set %s up;" % ifname LOG.info("add_ovs_port: cmd=%s" % cmd) os.system(cmd) @@ -44,11 +45,14 @@ def setup_intfs(sys_intf_mappings): else: pass -def setup_ips(ip_settings): +def setup_ips(ip_settings, sys_intf_mappings): LOG.info("setup_ips enter") for intf_info in ip_settings.values(): network = netaddr.IPNetwork(intf_info["cidr"]) - intf_name = intf_info["alias"] + if sys_intf_mappings[intf_info["name"]]["type"] == "ovs": + intf_name = intf_info["name"] + else: + intf_name = intf_info["alias"] cmd = "ip addr add %s/%s brd %s dev %s;" \ % (intf_info["ip"], intf_info["netmask"], str(network.broadcast),intf_name) if "gw" in intf_info: @@ -65,7 +69,7 @@ def setup_ips(ip_settings): def main(config): setup_bondings(config["bond_mappings"]) setup_intfs(config["sys_intf_mappings"]) - setup_ips(config["ip_settings"]) + setup_ips(config["ip_settings"], config["sys_intf_mappings"]) if __name__ == "__main__": os.system("service openvswitch-switch status|| service openvswitch-switch start") |