summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-10-02 01:16:08 +0000
committerGerrit Code Review <review@openstack.org>2012-10-02 01:16:08 +0000
commit659d4d5175fc857b1873edbc55cbf04eadc301b8 (patch)
tree57b9592d37a0e1b89424a5af150015826be0b87d /nova
parent771458f724a4ff1172b6b1a72d8b727fa07b94be (diff)
parent625996722f08b57b2926cf4d6aff5fe03abc196c (diff)
Merge "remove deprecated connection_type flag"
Diffstat (limited to 'nova')
-rw-r--r--nova/compute/manager.py1
-rw-r--r--nova/compute/utils.py6
-rw-r--r--nova/db/sqlalchemy/migrate_repo/versions/082_essex.py11
-rw-r--r--nova/exception.py2
-rw-r--r--nova/flags.py4
-rw-r--r--nova/tests/fake_flags.py1
-rw-r--r--nova/tests/test_virt_drivers.py29
-rw-r--r--nova/tests/test_xenapi.py3
-rw-r--r--nova/tests/test_xensm.py2
-rw-r--r--nova/virt/connection.py84
-rw-r--r--nova/volume/xensm.py5
11 files changed, 9 insertions, 139 deletions
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 ed76c72aa..a5a4854cd 100644
--- a/nova/tests/test_xenapi.py
+++ b/nova/tests/test_xenapi.py
@@ -1932,8 +1932,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 25d09a2ef..2f2108aa4 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