diff options
| author | Sean Dague <sdague@linux.vnet.ibm.com> | 2012-10-01 11:44:55 -0400 |
|---|---|---|
| committer | Sean Dague <sdague@linux.vnet.ibm.com> | 2012-10-01 15:14:39 -0400 |
| commit | 625996722f08b57b2926cf4d6aff5fe03abc196c (patch) | |
| tree | 247b519b74c6a026aaba46ff2ebb1b77106cadaf | |
| parent | 878dd9c0e29aeff4b485c28c63ba6c607fa7ca10 (diff) | |
| download | nova-625996722f08b57b2926cf4d6aff5fe03abc196c.tar.gz nova-625996722f08b57b2926cf4d6aff5fe03abc196c.tar.xz nova-625996722f08b57b2926cf4d6aff5fe03abc196c.zip | |
remove deprecated connection_type flag
Fixes bug #1025712
connection_type was deprecated in Folsom and should now
be removed in Grizzly as early as possible to shake out
any fallout. This removes all references to it, changes
the config sample and tests appropriately.
Remove old default fixtures for flavors that specify
ephemeral disks if the connection_type flag was set to
'libvirt'
Change-Id: I8af831600a1931ae92c6d06c5105bd1bd81debe3
| -rw-r--r-- | etc/nova/nova.conf.sample | 4 | ||||
| -rw-r--r-- | nova/compute/manager.py | 1 | ||||
| -rw-r--r-- | nova/compute/utils.py | 6 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/migrate_repo/versions/082_essex.py | 11 | ||||
| -rw-r--r-- | nova/exception.py | 2 | ||||
| -rw-r--r-- | nova/flags.py | 4 | ||||
| -rw-r--r-- | nova/tests/fake_flags.py | 1 | ||||
| -rw-r--r-- | nova/tests/test_virt_drivers.py | 29 | ||||
| -rw-r--r-- | nova/tests/test_xenapi.py | 3 | ||||
| -rw-r--r-- | nova/tests/test_xensm.py | 2 | ||||
| -rw-r--r-- | nova/virt/connection.py | 84 | ||||
| -rw-r--r-- | nova/volume/xensm.py | 5 |
12 files changed, 9 insertions, 143 deletions
diff --git a/etc/nova/nova.conf.sample b/etc/nova/nova.conf.sample index 13cc5289d..2580fafc9 100644 --- a/etc/nova/nova.conf.sample +++ b/etc/nova/nova.conf.sample @@ -73,10 +73,6 @@ ######## defined in nova.flags ######## -# connection_type=<None> -#### (StrOpt) Deprecated (use compute_driver instead): Virtualization api -#### connection type : libvirt, xenapi, or fake - # sql_connection=sqlite:///$state_path/$sqlite_db #### (StrOpt) The SQLAlchemy connection string used to connect to the #### database diff --git a/nova/compute/manager.py b/nova/compute/manager.py index f9c739001..9f311e881 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -85,7 +85,6 @@ compute_opts = [ "This is NOT the full path - just a folder name." "For per-compute-host cached images, set to _base_$my_ip"), cfg.StrOpt('compute_driver', - default='nova.virt.connection.get_connection', help='Driver to use for controlling virtualization. Options ' 'include: libvirt.LibvirtDriver, xenapi.XenAPIDriver, ' 'fake.FakeDriver, baremetal.BareMetalDriver, ' diff --git a/nova/compute/utils.py b/nova/compute/utils.py index a8a0a6544..17416f991 100644 --- a/nova/compute/utils.py +++ b/nova/compute/utils.py @@ -81,8 +81,7 @@ def get_device_name_for_instance(context, instance, device): except (TypeError, AttributeError, ValueError): raise exception.InvalidDevicePath(path=mappings['root']) # NOTE(vish): remove this when xenapi is setting default_root_device - if (FLAGS.connection_type == 'xenapi' or - FLAGS.compute_driver.endswith('xenapi.XenAPIDriver')): + if FLAGS.compute_driver.endswith('xenapi.XenAPIDriver'): prefix = '/dev/xvd' if req_prefix != prefix: LOG.debug(_("Using %(prefix)s instead of %(req_prefix)s") % locals()) @@ -97,8 +96,7 @@ def get_device_name_for_instance(context, instance, device): # NOTE(vish): remove this when xenapi is properly setting # default_ephemeral_device and default_swap_device - if (FLAGS.connection_type == 'xenapi' or - FLAGS.compute_driver.endswith('xenapi.XenAPIDriver')): + if FLAGS.compute_driver.endswith('xenapi.XenAPIDriver'): instance_type_id = instance['instance_type_id'] instance_type = instance_types.get_instance_type(instance_type_id) if instance_type['ephemeral_gb']: diff --git a/nova/db/sqlalchemy/migrate_repo/versions/082_essex.py b/nova/db/sqlalchemy/migrate_repo/versions/082_essex.py index 13dc02e9c..971fa3626 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/082_essex.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/082_essex.py @@ -30,16 +30,7 @@ LOG = logging.getLogger(__name__) # of integral type, so is no longer set explicitly in such cases. def _populate_instance_types(instance_types_table): - if FLAGS.connection_type == "libvirt": - default_inst_types = { - 'm1.tiny': dict(mem=512, vcpus=1, root_gb=0, eph_gb=0, flavid=1), - 'm1.small': dict(mem=2048, vcpus=1, root_gb=10, eph_gb=20, flavid=2), - 'm1.medium': dict(mem=4096, vcpus=2, root_gb=10, eph_gb=40, flavid=3), - 'm1.large': dict(mem=8192, vcpus=4, root_gb=10, eph_gb=80, flavid=4), - 'm1.xlarge': dict(mem=16384, vcpus=8, root_gb=10, eph_gb=160, flavid=5) - } - else: - default_inst_types = { + default_inst_types = { 'm1.tiny': dict(mem=512, vcpus=1, root_gb=0, eph_gb=0, flavid=1), 'm1.small': dict(mem=2048, vcpus=1, root_gb=20, eph_gb=0, flavid=2), 'm1.medium': dict(mem=4096, vcpus=2, root_gb=40, eph_gb=0, flavid=3), diff --git a/nova/exception.py b/nova/exception.py index 9c11dd822..b8df7ddcc 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -434,7 +434,7 @@ class NotFound(NovaException): class VirtDriverNotFound(NotFound): - message = _("Could not find driver for connection_type %(name)s") + message = _("Could not find driver for compute_driver %(name)s") class PersistentVolumeFileNotFound(NotFound): diff --git a/nova/flags.py b/nova/flags.py index e39f94457..34dbc72ef 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -74,10 +74,6 @@ def _get_my_ip(): core_opts = [ - cfg.StrOpt('connection_type', - default=None, - help='Deprecated (use compute_driver instead): Virtualization ' - 'api connection type : libvirt, xenapi, or fake'), cfg.StrOpt('sql_connection', default='sqlite:///$state_path/$sqlite_db', help='The SQLAlchemy connection string used to connect to the ' diff --git a/nova/tests/fake_flags.py b/nova/tests/fake_flags.py index f0fde3588..32f34b3e7 100644 --- a/nova/tests/fake_flags.py +++ b/nova/tests/fake_flags.py @@ -32,7 +32,6 @@ flags.DECLARE('volume_driver', 'nova.volume.manager') def set_defaults(conf): conf.set_default('api_paste_config', '$state_path/etc/nova/api-paste.ini') conf.set_default('compute_driver', 'nova.virt.fake.FakeDriver') - conf.set_default('connection_type', 'fake') conf.set_default('fake_network', True) conf.set_default('fake_rabbit', True) conf.set_default('flat_network_bridge', 'br100') diff --git a/nova/tests/test_virt_drivers.py b/nova/tests/test_virt_drivers.py index d24ad615a..05fe140d1 100644 --- a/nova/tests/test_virt_drivers.py +++ b/nova/tests/test_virt_drivers.py @@ -144,13 +144,6 @@ class VirtDriverLoaderTestCase(_FakeDriverBackendTestCase): 'libvirt.LibvirtDriver': 'LibvirtDriver' } - # NOTE(sdague): remove after Folsom release when connection_type - # is removed - old_drivers = { - 'libvirt': 'LibvirtDriver', - 'fake': 'FakeDriver' - } - def test_load_new_drivers(self): for cls, driver in self.new_drivers.iteritems(): self.flags(compute_driver=cls) @@ -164,28 +157,6 @@ class VirtDriverLoaderTestCase(_FakeDriverBackendTestCase): self.assertEqual(cm.driver.__class__.__name__, driver, "Could't load driver %s" % cls) - # NOTE(sdague): remove after Folsom release when connection_type - # is removed - def test_load_old_drivers(self): - # we explicitly use the old default - self.flags(compute_driver='nova.virt.connection.get_connection') - for cls, driver in self.old_drivers.iteritems(): - self.flags(connection_type=cls) - # NOTE(sdague) the try block is to make it easier to debug a - # failure by knowing which driver broke - try: - cm = ComputeManager() - except Exception as e: - self.fail("Couldn't load connection %s - %s" % (cls, e)) - - self.assertEqual(cm.driver.__class__.__name__, driver, - "Could't load connection %s" % cls) - - def test_fail_to_load_old_drivers(self): - self.flags(compute_driver='nova.virt.connection.get_connection') - self.flags(connection_type='56kmodem') - self.assertRaises(exception.VirtDriverNotFound, ComputeManager) - def test_fail_to_load_new_drivers(self): self.flags(compute_driver='nova.virt.amiga') diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index f8bf253cb..5c1187267 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -1957,8 +1957,7 @@ class XenAPIAggregateTestCase(stubs.XenAPITestBase): firewall_driver='nova.virt.xenapi.firewall.' 'Dom0IptablesFirewallDriver', host='host', - connection_type='xenapi', - compute_driver='nova.virt.xenapi.driver.XenAPIDriver') + compute_driver='xenapi.XenAPIDriver') host_ref = xenapi_fake.get_all('host')[0] stubs.stubout_session(self.stubs, stubs.FakeSessionForVMTests) self.context = context.get_admin_context() diff --git a/nova/tests/test_xensm.py b/nova/tests/test_xensm.py index c1748567b..a4c0fb07d 100644 --- a/nova/tests/test_xensm.py +++ b/nova/tests/test_xensm.py @@ -49,7 +49,7 @@ class XenSMTestCase(stubs.XenAPITestBase): self.user_id = 'fake' self.project_id = 'fake' self.context = context.RequestContext(self.user_id, self.project_id) - self.flags(connection_type='xenapi', + self.flags(compute_driver='xenapi.XenAPIDriver', xenapi_connection_url='http://test_url', xenapi_connection_username='test_user', xenapi_connection_password='test_pass') diff --git a/nova/virt/connection.py b/nova/virt/connection.py deleted file mode 100644 index 884bbb974..000000000 --- a/nova/virt/connection.py +++ /dev/null @@ -1,84 +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. -# Copyright (c) 2010 Citrix Systems, Inc. -# -# 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. - -"""Abstraction of the underlying virtualization API.""" - -import sys - -from nova.common import deprecated -from nova import exception -from nova import flags -from nova.openstack.common import importutils -from nova.openstack.common import log as logging -from nova import utils -from nova.virt import driver - -LOG = logging.getLogger(__name__) -FLAGS = flags.FLAGS - -known_drivers = { - 'baremetal': 'baremetal.BareMetalDriver', - 'fake': 'fake.FakeDriver', - 'libvirt': 'libvirt.LibvirtDriver', - 'vmwareapi': 'vmwareapi.VMWareESXDriver', - 'xenapi': 'xenapi.XenAPIDriver' - } - - -def get_connection(read_only=False): - """ - Returns an object representing the connection to a virtualization - platform, or to an on-demand bare-metal provisioning platform. - - This could be :mod:`nova.virt.fake.FakeConnection` in test mode, - a connection to KVM, QEMU, or UML via :mod:`libvirt_conn`, or a connection - to XenServer or Xen Cloud Platform via :mod:`xenapi`. Other platforms are - also supported. - - Any object returned here must conform to the interface documented by - :mod:`FakeConnection`. - - **Related flags** - - :connection_type: A string literal that falls through an if/elif structure - to determine what virtualization mechanism to use. - Values may be - - * fake - * libvirt - * xenapi - * vmwareapi - * baremetal - - """ - deprecated.warn(_('Specifying virt driver via connection_type is ' - 'deprecated. Use compute_driver=classname instead.')) - - driver_name = known_drivers.get(FLAGS.connection_type) - - if driver_name is None: - raise exception.VirtDriverNotFound(name=FLAGS.connection_type) - - conn = importutils.import_object_ns('nova.virt', driver_name, - read_only=read_only) - - if conn is None: - LOG.error(_('Failed to open connection to underlying virt platform')) - sys.exit(1) - return utils.check_isinstance(conn, driver.ComputeDriver) diff --git a/nova/volume/xensm.py b/nova/volume/xensm.py index 3deec66f0..7e9a4b0ee 100644 --- a/nova/volume/xensm.py +++ b/nova/volume/xensm.py @@ -98,8 +98,9 @@ class XenSMDriver(nova.volume.driver.VolumeDriver): # This driver leverages Xen storage manager, and hence requires # hypervisor to be Xen - if FLAGS.connection_type != 'xenapi': - msg = _('XenSMDriver requires xenapi connection') + if not FLAGS.compute_driver.endswith('XenAPIDriver'): + msg = (_('XenSMDriver requires xenapi connection, using %s') % + FLAGS.compute_driver) raise exception.VolumeBackendAPIException(data=msg) url = FLAGS.xenapi_connection_url |
