diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-11-16 17:16:13 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-11-16 17:16:13 +0000 |
commit | 049bad9d514f47f3dd19ccd6ba5996c6c9cb3365 (patch) | |
tree | 0d9558f363e1d96c507c6c0668fdeed80f8d17bf /nova/servicegroup | |
parent | b0fe8279e5918d0f59bdc9a2be6beb38da377c5c (diff) | |
parent | eb9863a4d22f41403f671146ec5e299a3df1f80c (diff) | |
download | nova-049bad9d514f47f3dd19ccd6ba5996c6c9cb3365.tar.gz |
Merge "Use oslo.config choices kwarg with StrOpt for servicegroup_driver"
Diffstat (limited to 'nova/servicegroup')
-rw-r--r-- | nova/servicegroup/api.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/nova/servicegroup/api.py b/nova/servicegroup/api.py index c435206771..0197b736e1 100644 --- a/nova/servicegroup/api.py +++ b/nova/servicegroup/api.py @@ -20,7 +20,7 @@ from oslo_config import cfg from oslo_log import log as logging from oslo_utils import importutils -from nova.i18n import _, _LW +from nova.i18n import _LW LOG = logging.getLogger(__name__) @@ -33,8 +33,9 @@ _default_driver = 'db' servicegroup_driver_opt = cfg.StrOpt('servicegroup_driver', default=_default_driver, help='The driver for servicegroup ' - 'service (valid options are: ' - 'db, zk, mc)') + 'service.', + choices=sorted( + _driver_name_class_mapping.keys())) CONF = cfg.CONF CONF.register_opt(servicegroup_driver_opt) @@ -64,12 +65,8 @@ class API(object): 'report_interval': report_interval, 'new_service_down_time': new_service_down_time}) CONF.set_override('service_down_time', new_service_down_time) - driver_name = CONF.servicegroup_driver - try: - driver_class = _driver_name_class_mapping[driver_name] - except KeyError: - raise TypeError(_("unknown ServiceGroup driver name: %s") - % driver_name) + + driver_class = _driver_name_class_mapping[CONF.servicegroup_driver] self._driver = importutils.import_object(driver_class, *args, **kwargs) |