"[%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)
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
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
) 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)