Allow bootstrapping against clusters and unify host options

The current settings inside freezer-manage reflect on using host and
port which are no longer used.  In addition, there seems to be no
splitting of the values in freezer-manage which means that it would
create a problem when trying to install against a list of hosts as
the ElasticSearch driver will refuse to accept the list.

This patch unifies all references of to 'hosts' and changes the option
to use ListOpt which is comma seperated values in the configuration
file which are then split into an array by oslo.config, which avoids
having to split things inside freezer.

Closes-Bug: #1681931

Change-Id: I613d0672ec2b186cd0d6365e795b35d9cff26dcd
This commit is contained in:
Mohammed Naser 2017-04-13 15:13:15 -04:00
parent 3ea8f90881
commit e0976af072
No known key found for this signature in database
GPG Key ID: 481CBC90384AEC42
3 changed files with 9 additions and 22 deletions

View File

@ -30,7 +30,6 @@ from freezer_api.storage import driver
CONF = cfg.CONF
LOG = log.getLogger(__name__)
DEFAULT_ES_SERVER_PORT = 9200
DEFAULT_INDEX = 'freezer'
DEFAULT_REPLICAS = 0
@ -51,17 +50,9 @@ def parse_config(mapping_choices):
title='DB Options',
handler=add_db_opts
),
cfg.HostAddressOpt('host',
default='127.0.0.1',
dest='host',
help='The DB host address[:port], '
'default "127.0.0.1"'),
cfg.PortOpt('port',
default=9200,
dest='port',
help='The DB server port (default: {0})'.
format(DEFAULT_ES_SERVER_PORT)
),
cfg.ListOpt('hosts',
default=['http://127.0.0.1:9200'],
help='specify the storage hosts'),
cfg.StrOpt('mapping',
dest='select_mapping',
default='',

View File

@ -281,10 +281,9 @@ class SessionTypeManager(TypeManager):
class ElasticSearchEngine(object):
_OPTS = [
cfg.StrOpt('hosts',
default='http://localhost:9200',
deprecated_name='endpoint',
help='specify the storage hosts'),
cfg.ListOpt('hosts',
default=['http://127.0.0.1:9200'],
help='specify the storage hosts'),
cfg.StrOpt('index',
default='freezer',
help='specify the name of the elasticsearch index'),
@ -323,7 +322,6 @@ class ElasticSearchEngine(object):
# register elasticsearch opts
CONF.register_opts(self._OPTS, group=backend)
self.conf = dict(CONF.get(backend))
self.conf['hosts'] = self.conf['hosts'].split(',')
self.backend = backend
self._validate_opts()
self.init(**self.conf)

View File

@ -320,10 +320,9 @@ class SessionTypeManagerV2(TypeManagerV2):
class ElasticSearchEngineV2(object):
_OPTS = [
cfg.StrOpt('hosts',
default='http://localhost:9200',
deprecated_name='endpoint',
help='specify the storage hosts'),
cfg.ListOpt('hosts',
default=['http://127.0.0.1:9200'],
help='specify the storage hosts'),
cfg.StrOpt('index',
default='freezer',
help='specify the name of the elasticsearch index'),
@ -362,7 +361,6 @@ class ElasticSearchEngineV2(object):
# register elasticsearch opts
CONF.register_opts(self._OPTS, group=backend)
self.conf = dict(CONF.get(backend))
self.conf['hosts'] = self.conf['hosts'].split(',')
self.backend = backend
self._validate_opts()
self.init(**self.conf)