Merge "NSX: Fix possible deadlock in sync code"
This commit is contained in:
commit
e8941a30cd
@ -297,14 +297,14 @@ class NvpSynchronizer():
|
|||||||
neutron_nvp_mappings[neutron_id] = (
|
neutron_nvp_mappings[neutron_id] = (
|
||||||
neutron_nvp_mappings.get(neutron_id, []) +
|
neutron_nvp_mappings.get(neutron_id, []) +
|
||||||
[self._nvp_cache[ls_uuid]])
|
[self._nvp_cache[ls_uuid]])
|
||||||
with ctx.session.begin(subtransactions=True):
|
|
||||||
# Fetch neutron networks from database
|
# Fetch neutron networks from database
|
||||||
filters = {'router:external': [False]}
|
filters = {'router:external': [False]}
|
||||||
if not scan_missing:
|
if not scan_missing:
|
||||||
filters['id'] = neutron_net_ids
|
filters['id'] = neutron_net_ids
|
||||||
# TODO(salv-orlando): Filter out external networks
|
# TODO(salv-orlando): Filter out external networks
|
||||||
for network in self._plugin._get_collection_query(
|
networks = self._plugin._get_collection_query(
|
||||||
ctx, models_v2.Network, filters=filters):
|
ctx, models_v2.Network, filters=filters)
|
||||||
|
for network in networks:
|
||||||
lswitches = neutron_nvp_mappings.get(network['id'], [])
|
lswitches = neutron_nvp_mappings.get(network['id'], [])
|
||||||
lswitches = [lswitch.get('data') for lswitch in lswitches]
|
lswitches = [lswitch.get('data') for lswitch in lswitches]
|
||||||
self.synchronize_network(ctx, network, lswitches)
|
self.synchronize_network(ctx, network, lswitches)
|
||||||
@ -348,12 +348,12 @@ class NvpSynchronizer():
|
|||||||
return
|
return
|
||||||
neutron_router_mappings = (
|
neutron_router_mappings = (
|
||||||
dict((lr_uuid, self._nvp_cache[lr_uuid]) for lr_uuid in lr_uuids))
|
dict((lr_uuid, self._nvp_cache[lr_uuid]) for lr_uuid in lr_uuids))
|
||||||
with ctx.session.begin(subtransactions=True):
|
|
||||||
# Fetch neutron routers from database
|
# Fetch neutron routers from database
|
||||||
filters = ({} if scan_missing else
|
filters = ({} if scan_missing else
|
||||||
{'id': neutron_router_mappings.keys()})
|
{'id': neutron_router_mappings.keys()})
|
||||||
for router in self._plugin._get_collection_query(
|
routers = self._plugin._get_collection_query(
|
||||||
ctx, l3_db.Router, filters=filters):
|
ctx, l3_db.Router, filters=filters)
|
||||||
|
for router in routers:
|
||||||
lrouter = neutron_router_mappings.get(router['id'])
|
lrouter = neutron_router_mappings.get(router['id'])
|
||||||
self.synchronize_router(
|
self.synchronize_router(
|
||||||
ctx, router, lrouter and lrouter.get('data'))
|
ctx, router, lrouter and lrouter.get('data'))
|
||||||
@ -425,7 +425,6 @@ class NvpSynchronizer():
|
|||||||
if neutron_port_id:
|
if neutron_port_id:
|
||||||
neutron_port_mappings[neutron_port_id] = (
|
neutron_port_mappings[neutron_port_id] = (
|
||||||
self._nvp_cache[lp_uuid])
|
self._nvp_cache[lp_uuid])
|
||||||
with ctx.session.begin(subtransactions=True):
|
|
||||||
# Fetch neutron ports from database
|
# Fetch neutron ports from database
|
||||||
# At the first sync we need to fetch all ports
|
# At the first sync we need to fetch all ports
|
||||||
filters = ({} if scan_missing else
|
filters = ({} if scan_missing else
|
||||||
@ -437,8 +436,9 @@ class NvpSynchronizer():
|
|||||||
external_net_db.ExternalNetwork,
|
external_net_db.ExternalNetwork,
|
||||||
(models_v2.Network.id ==
|
(models_v2.Network.id ==
|
||||||
external_net_db.ExternalNetwork.network_id))]
|
external_net_db.ExternalNetwork.network_id))]
|
||||||
for port in self._plugin._get_collection_query(
|
ports = self._plugin._get_collection_query(
|
||||||
ctx, models_v2.Port, filters=filters):
|
ctx, models_v2.Port, filters=filters)
|
||||||
|
for port in ports:
|
||||||
lswitchport = neutron_port_mappings.get(port['id'])
|
lswitchport = neutron_port_mappings.get(port['id'])
|
||||||
self.synchronize_port(
|
self.synchronize_port(
|
||||||
ctx, port, lswitchport and lswitchport.get('data'),
|
ctx, port, lswitchport and lswitchport.get('data'),
|
||||||
|
Loading…
Reference in New Issue
Block a user