diff options
author | Roman Podoliaka <rpodolyaka@mirantis.com> | 2014-09-17 01:06:33 +0300 |
---|---|---|
committer | Roman Podoliaka <rpodolyaka@mirantis.com> | 2014-09-17 01:32:26 +0300 |
commit | 02fa15b4caaa414930b6ddf6a3a9fe8019751c26 (patch) | |
tree | 57268d52f91162f546d3721e552b02b98029e619 | |
parent | 2e6eaa6c6e82d7fa7706ff8320b45cb837b98300 (diff) | |
download | nova-02fa15b4caaa414930b6ddf6a3a9fe8019751c26.tar.gz |
postgresql: use postgres db instead of template1
In PostgreSQL template1 database is kind of special, as all new databases are
copied from it, when you do CREATE DATABASE. This implies a few restrictions:
e.g. you can't have more than one active session to template1, if one of them
tries to create a database. It will fail with:
ERROR: source database "template1" is being accessed by other users
Using of postgres database instead of template1 resolves this issue.
Closes-Bug: #1355929
Change-Id: I8b1a36163984fbef6be66964456072d32da6a9d0
-rw-r--r-- | nova/tests/db/test_migrations.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/nova/tests/db/test_migrations.py b/nova/tests/db/test_migrations.py index f170df6666..fa4aee11ea 100644 --- a/nova/tests/db/test_migrations.py +++ b/nova/tests/db/test_migrations.py @@ -238,9 +238,9 @@ class BaseMigrationTestCase(test.NoDBTestCase): os.environ['PGUSER'] = user # note(boris-42): We must create and drop database, we can't # drop database which we have connected to, so for such - # operations there is a special database template1. + # operations there is a special database postgres. sqlcmd = ("psql -w -U %(user)s -h %(host)s -c" - " '%(sql)s' -d template1") + " '%(sql)s' -d postgres") sqldict = {'user': user, 'host': host} sqldict['sql'] = ("drop database if exists %s;") % database @@ -303,7 +303,7 @@ class BaseMigrationTestCase(test.NoDBTestCase): os.environ['PGUSER'] = user sqlcmd = ("psql -w -U %(user)s -h %(host)s -c" - " '%(sql)s' -d template1") + " '%(sql)s' -d postgres") sql = ("create database if not exists %s;") % database createtable = sqlcmd % {'user': user, 'host': host, 'sql': sql} |