Merge "Big Switch: Check for 'id' in port before lookup" into stable/icehouse
This commit is contained in:
commit
0fbb41ac45
|
@ -362,8 +362,10 @@ class NeutronRestProxyV2Base(db_base_plugin_v2.NeutronDbPluginV2,
|
|||
# In ML2, the host_id is already populated
|
||||
if portbindings.HOST_ID in port:
|
||||
hostid = port[portbindings.HOST_ID]
|
||||
else:
|
||||
elif 'id' in port:
|
||||
hostid = porttracker_db.get_port_hostid(context, port['id'])
|
||||
else:
|
||||
hostid = None
|
||||
if hostid:
|
||||
port[portbindings.HOST_ID] = hostid
|
||||
override = self._check_hostvif_override(hostid)
|
||||
|
|
|
@ -79,6 +79,12 @@ class TestBigSwitchProxyPortsV2(test_plugin.TestPortsV2,
|
|||
super(TestBigSwitchProxyPortsV2,
|
||||
self).setUp(self._plugin_name)
|
||||
|
||||
def test_get_ports_no_id(self):
|
||||
with self.port(name='test'):
|
||||
ports = NeutronManager.get_plugin().get_ports(
|
||||
context.get_admin_context(), fields=['name'])
|
||||
self.assertEqual(['name'], ports[0].keys())
|
||||
|
||||
def test_update_port_status_build(self):
|
||||
with self.port() as port:
|
||||
self.assertEqual(port['port']['status'], 'BUILD')
|
||||
|
|
Loading…
Reference in New Issue