Merge "storage: remove mongodb_replica_set option"

This commit is contained in:
Jenkins 2015-08-18 09:31:23 +00:00 committed by Gerrit Code Review
commit 8cffdd0f38
4 changed files with 7 additions and 14 deletions

View File

@ -34,11 +34,6 @@ OPTS = [
default=-1,
help=("Number of seconds that alarm histories are kept "
"in the database for (<= 0 means forever).")),
cfg.StrOpt('mongodb_replica_set',
default=None,
help='The name of the replica set which is used to connect to '
'MongoDB database. If it is set, MongoReplicaSetClient '
'will be used instead of MongoClient.'),
cfg.StrOpt('alarm_connection',
secret=True,
default=None,

View File

@ -44,8 +44,7 @@ class Connection(pymongo_base.Connection):
self.conn = self.CONNECTION_POOL.connect(
url,
conf.database.max_retries,
conf.database.retry_interval,
conf.database.mongodb_replica_set)
conf.database.retry_interval)
# Require MongoDB 2.4 to use $setOnInsert
if self.conn.server_info()['versionArray'] < [2, 4]:

View File

@ -59,7 +59,7 @@ class ConnectionPool(object):
def __init__(self):
self._pool = {}
def connect(self, url, max_retries, retry_interval, replica_set=None):
def connect(self, url, max_retries, retry_interval):
connection_options = pymongo.uri_parser.parse_uri(url)
del connection_options['database']
del connection_options['username']
@ -77,9 +77,7 @@ class ConnectionPool(object):
LOG.info(_('Connecting to %(db)s on %(nodelist)s') % log_data)
try:
client = MongoProxy(
pymongo.MongoClient(
url, replicaSet=replica_set,
),
pymongo.MongoClient(url),
max_retries,
retry_interval,
)

View File

@ -48,11 +48,12 @@ MongoDB
[database]
connection = mongodb://username:password@host:27017/aodh
If MongoDB is configured in replica set mode, add param in aodh.conf
to use MongoReplicaSetClient::
If MongoDB is configured in replica set mode, add `?replicaSet=` in your
connection URL::
[database]
mongodb_replica_set = replica_name
connection = mongodb://username:password@host:27017/aodh?replicaSet=foobar
SQLalchemy-supported DBs
------------------------