NSX|V: fix vnic allocation for AZ and metadata

When there are several availability zones using the same metadata
configuration, the DB vnic allocation failed to find the correct
internal network becasue it belongs to the default AZ and not the
specific one.

Change-Id: If35c814b55fd5632995cbace0689e4506563059d
This commit is contained in:
Adit Sarfaty 2017-06-07 12:56:56 +03:00
parent 50ef64ceb1
commit 7030a99cc0
1 changed files with 8 additions and 0 deletions

View File

@ -386,6 +386,14 @@ def get_nsxv_internal_network(session, network_purpose, availability_zone):
if net_list:
# Should have only one results as purpose+az are the keys
return net_list[0]
else:
# try the default availability zone, since this zone does not
# have his own
net_list = (session.query(nsxv_models.NsxvInternalNetworks).
filter_by(network_purpose=network_purpose,
availability_zone='default').all())
if net_list:
return net_list[0]
def get_nsxv_internal_networks(session, network_purpose):