From bc0ca46f8e6ce7e5944c01563341f55da2c4dac8 Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Wed, 7 Jun 2017 12:56:56 +0300 Subject: [PATCH] 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 --- vmware_nsx/db/nsxv_db.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vmware_nsx/db/nsxv_db.py b/vmware_nsx/db/nsxv_db.py index 35e379977c..c298e12b87 100644 --- a/vmware_nsx/db/nsxv_db.py +++ b/vmware_nsx/db/nsxv_db.py @@ -387,6 +387,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):