Stop using portbindings_db in BSN ML2 driver

Avoids using the portbindings_db in the Big Switch
ML2 driver since ML2 has deprecated that database for
its own version that tracks the same information.

Also eliminates unnecessary 'binding_host' field since
it is now always the same as as the 'portbinding:host_id'
field.

Closes-Bug: #1300628
Change-Id: I17d47cb446cdd2e989c3e0d01b797a81309faaa7
This commit is contained in:
Kevin Benton 2014-04-01 01:05:29 -07:00
parent 271fde0e31
commit 7a8a6a237b
3 changed files with 6 additions and 9 deletions

View File

@ -363,7 +363,11 @@ class NeutronRestProxyV2Base(db_base_plugin_v2.NeutronDbPluginV2,
"[%s]. Defaulting to ovs."),
cfg_vif_type)
cfg_vif_type = portbindings.VIF_TYPE_OVS
hostid = porttracker_db.get_port_hostid(context, port['id'])
# In ML2, the host_id is already populated
if portbindings.HOST_ID in port:
hostid = port[portbindings.HOST_ID]
else:
hostid = porttracker_db.get_port_hostid(context, port['id'])
if hostid:
port[portbindings.HOST_ID] = hostid
override = self._check_hostvif_override(hostid)

View File

@ -26,7 +26,6 @@ from neutron import context as ctx
from neutron.extensions import portbindings
from neutron.openstack.common import log
from neutron.plugins.bigswitch import config as pl_config
from neutron.plugins.bigswitch.db import porttracker_db
from neutron.plugins.bigswitch.plugin import NeutronRestProxyV2Base
from neutron.plugins.bigswitch import servermanager
from neutron.plugins.ml2 import driver_api as api
@ -99,14 +98,8 @@ class BigSwitchMechanismDriver(NeutronRestProxyV2Base,
port = copy.deepcopy(context.current)
net = context.network.current
port['network'] = net
port['binding_host'] = context._binding.host
port['bound_segment'] = context.bound_segment
actx = ctx.get_admin_context()
if (portbindings.HOST_ID in port and 'id' in port):
host_id = port[portbindings.HOST_ID]
porttracker_db.put_port_hostid(actx, port['id'], host_id)
else:
host_id = ''
prepped_port = self._extend_port_dict_binding(actx, port)
prepped_port = self._map_state_and_status(prepped_port)
if (portbindings.HOST_ID not in prepped_port or

View File

@ -117,6 +117,6 @@ class TestBigSwitchMechDriverPortsV2(test_db_plugin.TestPortsV2,
) as (mock_rest, p):
# make sure basic expected keys are present in the port body
pb = mock_rest.mock_calls[0][1][2]
self.assertEqual('host', pb['binding_host'])
self.assertEqual('host', pb['binding:host_id'])
self.assertIn('bound_segment', pb)
self.assertIn('network', pb)