Migrate fm, dcorch databases on upgrade
Perform the database migration on platform upgrade for fm and,
on SystemController, dcorch databases. The databases are
migrated on from side, and on N+1 side setting up configuration
file and performing the database migration.
Skip the fm 'alarm' table in case there were non-management
affecting alarms prior to the upgrade, that do not need to
appear again after controller-1 is upgraded.
When added to prior config commit 2a6d43d669
,
this closes bug 1885328
Tests:
Perform platform upgrade on SystemController
Verify upgrade database migrations for fm
Verify upgrade database migrations for dcorch
Change-Id: I1a3325c019f5d8fd4bd39f99d61b7610132c2d4f
Partial-bug: 1885328
Signed-off-by: John Kung <john.kung@windriver.com>
This commit is contained in:
parent
18d5985010
commit
85eb7a8415
|
@ -76,6 +76,9 @@ def get_db_credentials(shared_services, from_release, role=None):
|
|||
'sysinv': {'hiera_user_key': 'sysinv::db::postgresql::user',
|
||||
'keyring_password_key': 'sysinv',
|
||||
},
|
||||
'fm': {'hiera_user_key': 'fm::db::postgresql::user',
|
||||
'keyring_password_key': 'fm',
|
||||
},
|
||||
}
|
||||
|
||||
if sysinv_constants.SERVICE_TYPE_IDENTITY not in shared_services:
|
||||
|
@ -89,7 +92,11 @@ def get_db_credentials(shared_services, from_release, role=None):
|
|||
db_credential_keys.update(
|
||||
{'dcmanager': {'hiera_user_key': 'dcmanager::db::postgresql::user',
|
||||
'keyring_password_key': 'dcmanager',
|
||||
}})
|
||||
},
|
||||
'dcorch': {'hiera_user_key': 'dcorch::db::postgresql::user',
|
||||
'keyring_password_key': 'dcorch',
|
||||
},
|
||||
})
|
||||
|
||||
# Get the hiera data for the from release
|
||||
hiera_path = os.path.join(PLATFORM_PATH, "puppet", from_release,
|
||||
|
@ -575,6 +582,17 @@ def migrate_databases(from_release, shared_services, db_credentials,
|
|||
'--db-url %s' % get_connection_string(db_credentials, 'barbican')),
|
||||
]
|
||||
|
||||
# Migrate fm
|
||||
# append the migrate command for dcmanager db
|
||||
with open("/etc/fm/fm.conf", "w") as f:
|
||||
f.write("[database]\n")
|
||||
f.write(get_connection_string(db_credentials, 'fm'))
|
||||
|
||||
migrate_commands += [
|
||||
('fm',
|
||||
'fm-dbsync')
|
||||
]
|
||||
|
||||
if sysinv_constants.SERVICE_TYPE_IDENTITY not in shared_services:
|
||||
# To avoid a deadlock during keystone contract we will use offline
|
||||
# migration for simplex upgrades. Other upgrades will have to use
|
||||
|
@ -608,7 +626,6 @@ def migrate_databases(from_release, shared_services, db_credentials,
|
|||
|
||||
if role == sysinv_constants.DISTRIBUTED_CLOUD_ROLE_SYSTEMCONTROLLER:
|
||||
# append the migrate command for dcmanager db
|
||||
# todo(jkung): append the migrate command for dcorch
|
||||
with open("/etc/dcmanager/dcmanager.conf", "w") as f:
|
||||
f.write("[database]\n")
|
||||
f.write(get_connection_string(db_credentials, 'dcmanager'))
|
||||
|
@ -618,6 +635,16 @@ def migrate_databases(from_release, shared_services, db_credentials,
|
|||
'dcmanager-manage db_sync')
|
||||
]
|
||||
|
||||
# append the migrate command for dcorch db
|
||||
with open("/etc/dcorch/dcorch.conf", "w") as f:
|
||||
f.write("[database]\n")
|
||||
f.write(get_connection_string(db_credentials, 'dcorch'))
|
||||
|
||||
migrate_commands += [
|
||||
('dcorch',
|
||||
'dcorch-manage db_sync')
|
||||
]
|
||||
|
||||
# Execute migrate commands
|
||||
for cmd in migrate_commands:
|
||||
try:
|
||||
|
|
|
@ -27,11 +27,12 @@ LOG = log.getLogger(__name__)
|
|||
def get_upgrade_databases(system_role, shared_services):
|
||||
|
||||
UPGRADE_DATABASES = ('postgres', 'template1', 'sysinv',
|
||||
'barbican')
|
||||
'barbican', 'fm')
|
||||
|
||||
UPGRADE_DATABASE_SKIP_TABLES = {'postgres': (), 'template1': (),
|
||||
'sysinv': ('i_alarm',),
|
||||
'barbican': ()}
|
||||
'sysinv': (),
|
||||
'barbican': (),
|
||||
'fm': ('alarm',)}
|
||||
|
||||
if system_role == sysinv_constants.DISTRIBUTED_CLOUD_ROLE_SYSTEMCONTROLLER:
|
||||
UPGRADE_DATABASES += ('dcmanager', 'dcorch',)
|
||||
|
|
Loading…
Reference in New Issue