From f08cd2e31c05edeca2278f6fe5033dbfccfbf7a4 Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Sun, 24 Sep 2017 11:46:22 +0300 Subject: [PATCH] NSX|V raise error on mdproxy init When failing to create internal network or subnet, the mdproxy handler should raise an error, or else it will fail when returning None. Change-Id: I09e7eb13d9c76f9f3faa6a7ef50d6d8432225bd2 --- vmware_nsx/plugins/nsx_v/md_proxy.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v/md_proxy.py b/vmware_nsx/plugins/nsx_v/md_proxy.py index 25aa44ce26..ba70de93d6 100644 --- a/vmware_nsx/plugins/nsx_v/md_proxy.py +++ b/vmware_nsx/plugins/nsx_v/md_proxy.py @@ -165,7 +165,6 @@ class NsxVMetadataProxyHandler(object): return int_net['network_id'] def _get_internal_network_and_subnet(self, context): - # Try to find internal net, internal subnet. If not found, create new internal_net = self._get_internal_net_by_az(context) internal_subnet = None @@ -194,9 +193,10 @@ class NsxVMetadataProxyHandler(object): self.nsxv_plugin.delete_network(context, internal_net) - LOG.exception("Exception %s while creating internal " - "network for metadata service", e) - return + error = (_("Exception %s while creating internal " + "network for metadata service") % e) + LOG.exception(error) + raise nsxv_exc.NsxPluginException(err_msg=error) # Update the new network_id in DB nsxv_db.create_nsxv_internal_network(