diff --git a/vmtp/network.py b/vmtp/network.py index 35bcbe4..1625d1a 100644 --- a/vmtp/network.py +++ b/vmtp/network.py @@ -377,14 +377,16 @@ class Network(object): hostname = agent['host'] if 'Linux bridge' in agent_type: agent_detail = self.neutron_client.show_agent(agent['id'])['agent'] - ifname = agent_detail['configurations']['interface_mappings']['physnet1'] - internal_iface_dict[hostname] = ifname + if 'physnet1' in agent_detail['configurations']['interface_mappings']: + ifname = agent_detail['configurations']['interface_mappings']['physnet1'] + internal_iface_dict[hostname] = ifname elif 'Open vSwitch' in agent_type: network_type = self.vm_int_net[0]['provider:network_type'] agent_detail = self.neutron_client.show_agent(agent['id'])['agent'] if network_type == "vlan": - brname = agent_detail['configurations']['bridge_mappings']['physnet1'] - internal_iface_dict[hostname] = brname + if 'physnet1' in agent_detail['configurations']['bridge_mappings']: + brname = agent_detail['configurations']['bridge_mappings']['physnet1'] + internal_iface_dict[hostname] = brname elif network_type == "vxlan" or network_type == 'gre': ipaddr = agent_detail['configurations']['tunneling_ip'] internal_iface_dict[hostname] = ipaddr