MP2P migration: support changed configuration
Migrate resources that used to be in the neutron config and used by neutron resoruces, but were changed. Look for mdproxies & switching profiles currently used by neutron logical ports and migrate those as well. Change-Id: I7eeb24aea8d8b000f76dc998777aafd4788b68af
This commit is contained in:
parent
1531209a81
commit
76a94f461d
@ -455,6 +455,17 @@ def migrate_switch_profiles(nsxlib, nsxpolicy, plugin):
|
|||||||
|
|
||||||
# Include switch profiles that are in the nsx.ini
|
# Include switch profiles that are in the nsx.ini
|
||||||
conf_profiles = get_configured_values(plugin, 'switching_profiles')
|
conf_profiles = get_configured_values(plugin, 'switching_profiles')
|
||||||
|
|
||||||
|
# Add other switch profiles that might be used by neutron ports in the past
|
||||||
|
port_profiles = set()
|
||||||
|
ports = nsxlib.logical_port.list()['results']
|
||||||
|
for port in ports:
|
||||||
|
# Check that it is a neutron port
|
||||||
|
if not is_neutron_resource(port):
|
||||||
|
continue
|
||||||
|
for prof in port.get('switching_profile_ids', []):
|
||||||
|
port_profiles.add(prof['value'])
|
||||||
|
|
||||||
# Black list neuron & system profiles that should not be migrated
|
# Black list neuron & system profiles that should not be migrated
|
||||||
names_black_list = [v3_plugin_utils.NSX_V3_DHCP_PROFILE_NAME,
|
names_black_list = [v3_plugin_utils.NSX_V3_DHCP_PROFILE_NAME,
|
||||||
'ServiceInsertion_MacManagement_Profile']
|
'ServiceInsertion_MacManagement_Profile']
|
||||||
@ -464,6 +475,7 @@ def migrate_switch_profiles(nsxlib, nsxpolicy, plugin):
|
|||||||
return (resource.get('resource_type') == resource_type and
|
return (resource.get('resource_type') == resource_type and
|
||||||
resource.get('display_name') not in names_black_list and
|
resource.get('display_name') not in names_black_list and
|
||||||
(resource.get('id') in conf_profiles or
|
(resource.get('id') in conf_profiles or
|
||||||
|
resource.get('id') in port_profiles or
|
||||||
resource.get('_system_owned', True) or
|
resource.get('_system_owned', True) or
|
||||||
is_neutron_resource(resource)))
|
is_neutron_resource(resource)))
|
||||||
return cond
|
return cond
|
||||||
@ -540,6 +552,18 @@ def migrate_switch_profiles(nsxlib, nsxpolicy, plugin):
|
|||||||
def migrate_md_proxies(nsxlib, nsxpolicy, plugin):
|
def migrate_md_proxies(nsxlib, nsxpolicy, plugin):
|
||||||
neutron_md = get_configured_values(plugin, '_native_md_proxy_uuid')
|
neutron_md = get_configured_values(plugin, '_native_md_proxy_uuid')
|
||||||
|
|
||||||
|
# Add other mdproxies that might be used by neutron networks in the past
|
||||||
|
ports = nsxlib.logical_port.list()['results']
|
||||||
|
for port in ports:
|
||||||
|
# Check that it is a neutron port
|
||||||
|
if not is_neutron_resource(port):
|
||||||
|
continue
|
||||||
|
if (port.get('attachment') and
|
||||||
|
port['attachment'].get('attachment_type') == 'METADATA_PROXY'):
|
||||||
|
mdproxy_id = port['attachment'].get('id')
|
||||||
|
if mdproxy_id not in neutron_md:
|
||||||
|
neutron_md.append(port['attachment'].get('id'))
|
||||||
|
|
||||||
def cond(resource):
|
def cond(resource):
|
||||||
return resource.get('id') in neutron_md
|
return resource.get('id') in neutron_md
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user