diff --git a/nova/api/openstack/compute/routes.py b/nova/api/openstack/compute/routes.py index d6a0422c5edc..6b0480ec555e 100644 --- a/nova/api/openstack/compute/routes.py +++ b/nova/api/openstack/compute/routes.py @@ -75,6 +75,7 @@ from nova.api.openstack.compute import shelve from nova.api.openstack.compute import simple_tenant_usage from nova.api.openstack.compute import suspend_server from nova.api.openstack.compute import used_limits +from nova.api.openstack.compute import virtual_interfaces from nova.api.openstack import wsgi import nova.conf @@ -274,6 +275,10 @@ simple_tenant_usage_controller = functools.partial(_create_controller, simple_tenant_usage.SimpleTenantUsageController, [], []) +virtual_interfaces_controller = functools.partial(_create_controller, + virtual_interfaces.ServerVirtualInterfaceController, [], []) + + # NOTE(alex_xu): This is structure of this route list as below: # ( # ('Route path': { @@ -553,6 +558,9 @@ ROUTE_LIST = ( 'GET': [server_password_controller, 'index'], 'DELETE': [server_password_controller, 'clear'] }), + ('/servers/{server_id}/os-virtual-interfaces', { + 'GET': [virtual_interfaces_controller, 'index'] + }), ('/servers/{server_id}/tags', { 'GET': [server_tags_controller, 'index'], 'PUT': [server_tags_controller, 'update_all'], diff --git a/nova/api/openstack/compute/virtual_interfaces.py b/nova/api/openstack/compute/virtual_interfaces.py index 6b59e9472246..5319a4855fad 100644 --- a/nova/api/openstack/compute/virtual_interfaces.py +++ b/nova/api/openstack/compute/virtual_interfaces.py @@ -27,9 +27,6 @@ from nova import network from nova.policies import virtual_interfaces as vif_policies -ALIAS = 'os-virtual-interfaces' - - def _translate_vif_summary_view(req, vif): """Maps keys for VIF summary view.""" d = {} @@ -77,25 +74,3 @@ class ServerVirtualInterfaceController(wsgi.Controller): """Returns the list of VIFs for a given instance.""" return self._items(req, server_id, entity_maker=_translate_vif_summary_view) - - -class VirtualInterfaces(extensions.V21APIExtensionBase): - """Virtual interface support.""" - - name = "VirtualInterfaces" - alias = ALIAS - version = 1 - - def get_resources(self): - resources = [] - - res = extensions.ResourceExtension( - ALIAS, - controller=ServerVirtualInterfaceController(), - parent=dict(member_name='server', collection_name='servers')) - resources.append(res) - - return resources - - def get_controller_extensions(self): - return [] diff --git a/setup.cfg b/setup.cfg index 7735bcfac239..8542df3731da 100644 --- a/setup.cfg +++ b/setup.cfg @@ -94,7 +94,6 @@ nova.api.v21.extensions = tenant_networks = nova.api.openstack.compute.tenant_networks:TenantNetworks user_data = nova.api.openstack.compute.user_data:UserData versions = nova.api.openstack.compute.versionsV21:Versions - virtual_interfaces = nova.api.openstack.compute.virtual_interfaces:VirtualInterfaces volumes = nova.api.openstack.compute.volumes:Volumes nova.api.v21.test_extensions =