b004985c24
This patch includes the initial framework to allow existing neutron deployments running different backends to be migrated over to the nsx-v3 plugin. The main logic that is required to do this is to allow the ability of an id to be specified for a given resource. This patch makes this possible with the addition of a new extension api-replay. The reason why a new extension is needed is because the RESOURCE_MAP is loaded after the plugin is loaded. Therefore, there is no way for me to change the mapping directly in the plugin without creating an extension to do so. This patch also adds support for migrating the router-uplink and floatingips which was missing in the previous patchset. Here's an example output of the migration tool running: http://codepad.org/I7x6Rq3u Change-Id: I2ee9778374a8d137e06125f2732524c7c662c002
74 lines
2.1 KiB
Python
74 lines
2.1 KiB
Python
# Copyright 2016 VMware, Inc.
|
|
#
|
|
# All Rights Reserved
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
#
|
|
|
|
from neutron.api import extensions
|
|
|
|
|
|
RESOURCE_ATTRIBUTE_MAP = {
|
|
'ports': {
|
|
'id': {'allow_post': True, 'allow_put': False,
|
|
'validate': {'type:uuid': None},
|
|
'is_visible': True},
|
|
},
|
|
'networks': {
|
|
'id': {'allow_post': True, 'allow_put': False,
|
|
'validate': {'type:uuid': None},
|
|
'is_visible': True},
|
|
},
|
|
'security_groups': {
|
|
'id': {'allow_post': True, 'allow_put': False,
|
|
'validate': {'type:uuid': None},
|
|
'is_visible': True},
|
|
},
|
|
'security_group_rules': {
|
|
'id': {'allow_post': True, 'allow_put': False,
|
|
'validate': {'type:uuid': None},
|
|
'is_visible': True},
|
|
},
|
|
'routers': {
|
|
'id': {'allow_post': True, 'allow_put': False,
|
|
'validate': {'type:uuid': None},
|
|
'is_visible': True},
|
|
},
|
|
}
|
|
|
|
|
|
class Api_replay(extensions.ExtensionDescriptor):
|
|
"""Extension for api replay which allows us to specify ids of resources."""
|
|
|
|
@classmethod
|
|
def get_name(cls):
|
|
return "Api Replay"
|
|
|
|
@classmethod
|
|
def get_alias(cls):
|
|
return 'api-replay'
|
|
|
|
@classmethod
|
|
def get_description(cls):
|
|
return "Enables mode to allow api to be replayed"
|
|
|
|
@classmethod
|
|
def get_updated(cls):
|
|
return "2016-05-05T10:00:00-00:00"
|
|
|
|
def get_extended_resources(self, version):
|
|
if version == "2.0":
|
|
return RESOURCE_ATTRIBUTE_MAP
|
|
else:
|
|
return {}
|