From fce8d74d963d31dfdedeced1f36c971063ac1509 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Tue, 31 Jan 2012 16:29:28 -0600 Subject: [PATCH] remove unsupported ec2 extensions implements blueprint remove-ec2-extensions * remove deprecated unofficial ec2 admin api * remove admin api from wsgi/paste * remove unofficial ec2 call for ajaxterm / update calls * remove displayName/displayDescription from volumes/instances Change-Id: If5a5ae26ebb9456a3c7376ff4ff0aa9589be1f5b --- bin/nova-manage | 8 +++- doc/source/devref/api.rst | 9 ---- nova/flags.py | 3 -- nova/tests/test_adminapi.py | 92 ------------------------------------- 4 files changed, 6 insertions(+), 106 deletions(-) delete mode 100644 nova/tests/test_adminapi.py diff --git a/bin/nova-manage b/bin/nova-manage index 1275d72d9..69a293ce1 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -89,11 +89,11 @@ from nova import rpc from nova import utils from nova import version from nova import vsa -from nova.api.ec2 import admin from nova.api.ec2 import ec2utils from nova.auth import manager from nova.cloudpipe import pipelib from nova.compute import instance_types +from nova.compute import vm_states from nova.db import migration from nova.volume import volume_types @@ -214,7 +214,11 @@ class VpnCommands(object): 'vpn_public_port': int(port)}) def _vpn_for(self, context, project_id): - return admin.AdminController()._vpn_for(context, project_id) + """Get the VPN instance for a project ID.""" + for instance in db.instance_get_all_by_project(context, project_id): + if (instance['image_id'] == str(FLAGS.vpn_image_id) + and not instance['vm_state'] in [vm_states.DELETED]): + return instance class ShellCommands(object): diff --git a/doc/source/devref/api.rst b/doc/source/devref/api.rst index 35abf1ae0..92a3dc911 100644 --- a/doc/source/devref/api.rst +++ b/doc/source/devref/api.rst @@ -129,15 +129,6 @@ The :mod:`nova.api.ec2` Module :undoc-members: :show-inheritance: -The :mod:`admin` Module -~~~~~~~~~~~~~~~~~~~~~~~ - -.. automodule:: nova.api.ec2.admin - :noindex: - :members: - :undoc-members: - :show-inheritance: - The :mod:`apirequest` Module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/nova/flags.py b/nova/flags.py index 146817272..4c0d61498 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -520,9 +520,6 @@ global_opts = [ cfg.IntOpt('zombie_instance_updated_at_window', default=172800, help='Number of seconds zombie instances are cleaned up.'), - cfg.BoolOpt('allow_ec2_admin_api', - default=False, - help='Enable/Disable EC2 Admin API'), cfg.IntOpt('service_down_time', default=60, help='maximum time since last check-in for up service'), diff --git a/nova/tests/test_adminapi.py b/nova/tests/test_adminapi.py deleted file mode 100644 index dba2a2780..000000000 --- a/nova/tests/test_adminapi.py +++ /dev/null @@ -1,92 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# 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 nova import context -from nova import db -from nova import flags -from nova import log as logging -from nova import rpc -from nova import test -from nova import utils -from nova.api.ec2 import admin -from nova.image import fake - - -FLAGS = flags.FLAGS -LOG = logging.getLogger('nova.tests.adminapi') - - -class AdminApiTestCase(test.TestCase): - def setUp(self): - super(AdminApiTestCase, self).setUp() - self.flags(connection_type='fake') - - # set up our cloud - self.api = admin.AdminController() - - # set up services - self.compute = self.start_service('compute') - self.scheduter = self.start_service('scheduler') - self.network = self.start_service('network') - self.volume = self.start_service('volume') - self.image_service = utils.import_object(FLAGS.image_service) - - self.user_id = 'admin' - self.project_id = 'admin' - self.context = context.RequestContext(self.user_id, - self.project_id, - is_admin=True) - - def fake_show(meh, context, id): - return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1, - 'type': 'machine', 'image_state': 'available'}} - - self.stubs.Set(fake._FakeImageService, 'show', fake_show) - self.stubs.Set(fake._FakeImageService, 'show_by_name', fake_show) - - # NOTE(comstud): Make 'cast' behave like a 'call' which will - # ensure that operations complete - self.stubs.Set(rpc, 'cast', rpc.call) - - def test_block_external_ips(self): - """Make sure provider firewall rules are created.""" - result = self.api.block_external_addresses(self.context, '1.1.1.1/32') - self.api.remove_external_address_block(self.context, '1.1.1.1/32') - self.assertEqual('OK', result['status']) - self.assertEqual('Added 3 rules', result['message']) - - def test_list_blocked_ips(self): - """Make sure we can see the external blocks that exist.""" - self.api.block_external_addresses(self.context, '1.1.1.2/32') - result = self.api.describe_external_address_blocks(self.context) - num = len(db.provider_fw_rule_get_all(self.context)) - self.api.remove_external_address_block(self.context, '1.1.1.2/32') - # we only list IP, not tcp/udp/icmp rules - self.assertEqual(num / 3, len(result['externalIpBlockInfo'])) - - def test_remove_ip_block(self): - """Remove ip blocks.""" - result = self.api.block_external_addresses(self.context, '1.1.1.3/32') - self.assertEqual('OK', result['status']) - num0 = len(db.provider_fw_rule_get_all(self.context)) - result = self.api.remove_external_address_block(self.context, - '1.1.1.3/32') - self.assertEqual('OK', result['status']) - self.assertEqual('Deleted 3 rules', result['message']) - num1 = len(db.provider_fw_rule_get_all(self.context)) - self.assert_(num1 < num0)