lswitch = (self._nvp_cache[ls_uuid].get('data') or
self._nvp_cache[ls_uuid].get('data_bk'))
tags = self._get_tag_dict(lswitch['tags'])
- neutron_id = tags.get('neutron_net_id', ls_uuid)
+ neutron_id = tags.get('quantum_net_id')
neutron_net_ids.add(neutron_id)
neutron_nvp_mappings[neutron_id] = (
neutron_nvp_mappings.get(neutron_id, []) +
filters = {'router:external': [False]}
if not scan_missing:
filters['id'] = neutron_net_ids
- # TODO(salv-orlando): Filter out external networks
networks = self._plugin._get_collection_query(
ctx, models_v2.Network, filters=filters)
for network in networks:
def _synchronize_lrouters(self, ctx, lr_uuids, scan_missing=False):
if not lr_uuids and not scan_missing:
return
- neutron_router_mappings = (
- dict((lr_uuid, self._nvp_cache[lr_uuid]) for lr_uuid in lr_uuids))
+ # TODO(salvatore-orlando): Deal with the case the tag
+ # has been tampered with
+ neutron_router_mappings = {}
+ for lr_uuid in lr_uuids:
+ lrouter = (self._nvp_cache[lr_uuid].get('data') or
+ self._nvp_cache[lr_uuid].get('data_bk'))
+ tags = self._get_tag_dict(lrouter['tags'])
+ neutron_router_id = tags.get('q_router_id')
+ if neutron_router_id:
+ neutron_router_mappings[neutron_router_id] = (
+ self._nvp_cache[lr_uuid])
+ else:
+ LOG.warn(_("Unable to find Neutron router id for "
+ "NSX logical router: %s"), lr_uuid)
# Fetch neutron routers from database
filters = ({} if scan_missing else
{'id': neutron_router_mappings.keys()})
with self._populate_data(ctx):
sp = sync.SyncParameters(100)
self._plugin._synchronizer._synchronize_state(sp)
+ # Ensure the synchronizer performs a resync
+ sp.init_sync_performed = True
self._test_sync(
constants.NET_STATUS_DOWN, constants.PORT_STATUS_DOWN,
- constants.NET_STATUS_DOWN, self._action_callback_status_down)
+ constants.NET_STATUS_DOWN, self._action_callback_status_down,
+ sp=sp)
def _action_callback_del_resource(self, ls_uuid, lp_uuid, lr_uuid):
del self.fc._fake_lswitch_dict[ls_uuid]
with self._populate_data(ctx):
sp = sync.SyncParameters(100)
self._plugin._synchronizer._synchronize_state(sp)
+ # Ensure the synchronizer performs a resync
+ sp.init_sync_performed = True
self._test_sync(
constants.NET_STATUS_ERROR, constants.PORT_STATUS_ERROR,
- constants.NET_STATUS_ERROR, self._action_callback_del_resource)
+ constants.NET_STATUS_ERROR, self._action_callback_del_resource,
+ sp=sp)
def _test_sync_with_chunk_larger_maxpagesize(
self, net_size, port_size, router_size, chunk_size, exp_calls):