summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nova/ipv6/api.py7
-rw-r--r--nova/utils.py35
-rw-r--r--setup.cfg3
3 files changed, 6 insertions, 39 deletions
diff --git a/nova/ipv6/api.py b/nova/ipv6/api.py
index f57a4554d8..7fedfe8332 100644
--- a/nova/ipv6/api.py
+++ b/nova/ipv6/api.py
@@ -13,8 +13,8 @@
# under the License.
from oslo_config import cfg
+from stevedore import driver
-from nova import utils
ipv6_backend_opt = cfg.StrOpt('ipv6_backend',
default='rfc2462',
@@ -27,9 +27,8 @@ IMPL = None
def reset_backend():
global IMPL
- IMPL = utils.LazyPluggable('ipv6_backend',
- rfc2462='nova.ipv6.rfc2462',
- account_identifier='nova.ipv6.account_identifier')
+ IMPL = driver.DriverManager("nova.ipv6_backend",
+ CONF.ipv6_backend).driver
def to_global(prefix, mac, project_id):
diff --git a/nova/utils.py b/nova/utils.py
index 3459012df6..f76745ebc4 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -372,41 +372,6 @@ def get_my_linklocal(interface):
raise exception.NovaException(msg)
-class LazyPluggable(object):
- """A pluggable backend loaded lazily based on some value."""
-
- def __init__(self, pivot, config_group=None, **backends):
- self.__backends = backends
- self.__pivot = pivot
- self.__backend = None
- self.__config_group = config_group
-
- def __get_backend(self):
- if not self.__backend:
- if self.__config_group is None:
- backend_name = CONF[self.__pivot]
- else:
- backend_name = CONF[self.__config_group][self.__pivot]
- if backend_name not in self.__backends:
- msg = _('Invalid backend: %s') % backend_name
- raise exception.NovaException(msg)
-
- backend = self.__backends[backend_name]
- if isinstance(backend, tuple):
- name = backend[0]
- fromlist = backend[1]
- else:
- name = backend
- fromlist = backend
-
- self.__backend = __import__(name, None, None, fromlist)
- return self.__backend
-
- def __getattr__(self, key):
- backend = self.__get_backend()
- return getattr(backend, key)
-
-
def xhtml_escape(value):
"""Escapes a string so it is valid within XML or XHTML.
diff --git a/setup.cfg b/setup.cfg
index cd07ed6e09..6422e59638 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -170,6 +170,9 @@ nova.api.v3.test_extensions =
basic = nova.tests.unit.api.openstack.compute.test_plugins.basic:Basic
microversions = nova.tests.unit.api.openstack.compute.test_plugins.microversions:Microversions
+nova.ipv6_backend =
+ rfc2462 = nova.ipv6.rfc2462
+ account_identifier = nova.ipv6.account_identifier
# These are for backwards compat with Havana notification_driver configuration values
oslo.messaging.notify.drivers =