From fa0999dd13e1c04cda283390440a0d55f5b617d7 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Thu, 3 Aug 2017 05:12:24 -0700 Subject: [PATCH] NSX|V: save PUT when restarting neutron Only update the MD proxy configuration if there is a change in the IP settings. Do not do this at each restart. Change-Id: Ieb648f95a5ea925f1a1b7a10c1c0c3b3641d6f0c --- vmware_nsx/plugins/nsx_v/md_proxy.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v/md_proxy.py b/vmware_nsx/plugins/nsx_v/md_proxy.py index 448e215bb1..33879a7f67 100644 --- a/vmware_nsx/plugins/nsx_v/md_proxy.py +++ b/vmware_nsx/plugins/nsx_v/md_proxy.py @@ -359,6 +359,7 @@ class NsxVMetadataProxyHandler(object): self.nsxv_plugin.nsx_v.vcns, edge_id) vs = lb_obj.virtual_servers.get(METADATA_VSE_NAME) + update_md_proxy = False if vs: md_members = {member.payload['ipAddress']: member.payload['name'] for member in vs.default_pool.members.values()} @@ -369,7 +370,8 @@ class NsxVMetadataProxyHandler(object): set(cfg.CONF.nsxv.nova_metadata_ips))) m_ip_to_set = (list(set(cfg.CONF.nsxv.nova_metadata_ips) - set(m_ips))) - + if m_to_convert or m_ip_to_set: + update_md_proxy = True for m_ip in m_to_convert: m_name = md_members[m_ip] vs.default_pool.members[m_name].payload['ipAddress'] = ( @@ -380,7 +382,9 @@ class NsxVMetadataProxyHandler(object): try: # This may fail if the edge is powered off right now - lb_obj.submit_to_backend(self.nsxv_plugin.nsx_v.vcns, edge_id) + if update_md_proxy: + lb_obj.submit_to_backend(self.nsxv_plugin.nsx_v.vcns, + edge_id) except exceptions.RequestBad as e: # log the error and continue LOG.error("Failed to update load balancer on metadata "