influxdb: do not try to create a database
This is not the responsibility of the driver to do that. Change-Id: I72384a292b62e056f2082cee21bf916561f3d3d7 Closes-Bug: #1535487
This commit is contained in:
parent
dd1b7a4dca
commit
8fa223e765
@ -73,18 +73,6 @@ class InfluxDBStorage(storage.StorageDriver):
|
||||
conf.influxdb_password,
|
||||
conf.influxdb_database)
|
||||
self.database = conf.influxdb_database
|
||||
try:
|
||||
dbs = [db['name'] for db in self.influx.get_list_database()]
|
||||
if conf.influxdb_database not in dbs:
|
||||
self.influx.create_database(conf.influxdb_database)
|
||||
except influxdb.client.InfluxDBClientError as e:
|
||||
if "database already exists" in e.content:
|
||||
LOG.warning("InfluxDB database \"%s\" already exists",
|
||||
self.database)
|
||||
else:
|
||||
LOG.warning('InfluxDB database creation failed: %s %s'
|
||||
% (e.message, e.code), exc_info=True)
|
||||
raise
|
||||
|
||||
@staticmethod
|
||||
def _get_metric_id(metric):
|
||||
|
@ -402,6 +402,7 @@ class TestCase(base.BaseTestCase):
|
||||
elif self.conf.storage.driver == 'influxdb':
|
||||
self.conf.set_override('influxdb_block_until_data_ingested', True,
|
||||
'storage')
|
||||
self.conf.set_override('influxdb_database', 'test', 'storage')
|
||||
self.conf.set_override('influxdb_password', 'root', 'storage')
|
||||
self.conf.set_override('influxdb_port',
|
||||
os.getenv("GNOCCHI_TEST_INFLUXDB_PORT",
|
||||
|
@ -36,6 +36,8 @@ EOF
|
||||
PATH=$PATH:/opt/influxdb influxd -config $INFLUXDB_DATA/config > ${INFLUXDB_DATA}/out 2>&1 &
|
||||
# Wait for InfluxDB to start listening to connections
|
||||
wait_for_line "Listening on HTTP" ${INFLUXDB_DATA}/out
|
||||
influx -port $GNOCCHI_TEST_INFLUXDB_PORT -execute "CREATE DATABASE test;"
|
||||
|
||||
|
||||
$*
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user