AdminUtil:NSX|V3: change metadata server

Adding support for changing the metadat-proxy-uuid for all existing networks.
Usage:
nsxadmin -r metadata-proxy -o nsx-update --property metadata_proxy_uuid=<metadata_proxy_uuid>

Change-Id: I1c3bab6e52ce9f635d565ba3da5151bf2bc57d2a
This commit is contained in:
Adit Sarfaty 2017-05-08 12:22:42 +03:00
parent 80d09b9787
commit ee105f5372
2 changed files with 18 additions and 7 deletions

View File

@ -294,7 +294,7 @@ Metadata Proxy
nsxadmin -r metadata-proxy -o list
- Resync metadata proxies for NSXv3 version 1.1.0 and above::
- Resync metadata proxies for NSXv3 version 1.1.0 and above (enable md proxy, or update the uuid)::
nsxadmin -r metadata-proxy -o nsx-update --property metadata_proxy_uuid=<metadata_proxy_uuid>

View File

@ -110,12 +110,23 @@ def nsx_update_metadata_proxy(resource, event, trigger, **kwargs):
project_name='admin')
name = nsx_utils.get_name_and_uuid('%s-%s' % (
'mdproxy', network['name'] or 'network'), network['id'])
# create a new port with the md-proxy
port_resource.create(
lswitch_id, metadata_proxy_uuid, tags=tags, name=name,
attachment_type=nsx_constants.ATTACHMENT_MDPROXY)
LOG.info("Enabled native metadata proxy for network %s",
network['id'])
# check if this logical port already exists
existing_ports = port_resource.find_by_display_name(name)
if not existing_ports:
# create a new port with the md-proxy
port_resource.create(
lswitch_id, metadata_proxy_uuid, tags=tags, name=name,
attachment_type=nsx_constants.ATTACHMENT_MDPROXY)
LOG.info("Enabled native metadata proxy for network %s",
network['id'])
else:
# update the MDproxy of this port
port = existing_ports[0]
port_resource.update(
port['id'], metadata_proxy_uuid,
attachment_type=nsx_constants.ATTACHMENT_MDPROXY)
LOG.info("Updated native metadata proxy for network %s",
network['id'])
registry.subscribe(list_metadata_networks,