NSX-mh: use router_distributed flag

Even if the plugin technically already leverages this flag as it's
used in the l3_dvr_db mixin, the logic for the NSX-mh implies that
it is the backend that decides whether routers by default are
centralized or distributed.

This patches changes the logic for the default value for distributed
routers, ensuting the router_distributed flag is honoured.

Change-Id: I6cee010622d310477867b94b754aa2260b43b879
Closes-Bug: #1483920
This commit is contained in:
Salvatore Orlando 2015-08-11 15:54:03 -07:00
parent ba3d9d0356
commit 0649bb61f9
1 changed files with 3 additions and 5 deletions

View File

@ -1437,12 +1437,10 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
# becomes an asynchronous task
neutron_router_id = str(uuid.uuid4())
r['id'] = neutron_router_id
# Populate distributed attribute in order to ensure the appropriate
# type of router is created in the NSX backend
r['distributed'] = l3_dvr_db.is_distributed_router(r)
lrouter = self._create_lrouter(context, r, nexthop)
# Update 'distributed' with value returned from NSX
# This will be useful for setting the value if the API request
# did not specify any value for the 'distributed' attribute
# Platforms older than 3.x do not support the attribute
r['distributed'] = lrouter.get('distributed', False)
# TODO(salv-orlando): Deal with backend object removal in case
# of db failures
with context.session.begin(subtransactions=True):