Config Group Load Fails If DS Version Inactive

trove-manage db_load_datastore_config_parameters will fail if
the datastore_version on which it's being run is marked as
inactive (aka active is set to 0).

this is not correct, because it's completely reasonable to want
to update/refresh a datastore_version's configuration-group's
parameters even if it's inactive.

examples:
- you're working on rolling out a new datastore_version, so
  you have it marked as active=0 until the go-live date.
- you've rolled out a new datastore_version and want to
  mark the old version as inactive. instances built prior
  to the inactivation are still on the old version, and
  can still utilize their still-assigned configuration-groups,
  hence the parameters should be updateable by the
  administrator.

Change-Id: I7682fe240c5737438b084d813cf7ce80b4ecca9b
Closes-Bug: #1379563
This commit is contained in:
amcrn 2014-10-16 23:14:20 -07:00 committed by Auston McReynolds
parent 3864816fd6
commit 7d26dfe906
2 changed files with 3 additions and 3 deletions

View File

@ -397,7 +397,7 @@ def load_datastore_configuration_parameters(datastore,
config_file):
get_db_api().configure_db(CONF)
(ds, ds_v) = dstore_models.get_datastore_version(
type=datastore, version=datastore_version)
type=datastore, version=datastore_version, return_inactive=True)
with open(config_file) as f:
config = json.load(f)
for param in config['configuration-parameters']:

View File

@ -468,7 +468,7 @@ class DatastoreVersions(object):
yield item
def get_datastore_version(type=None, version=None):
def get_datastore_version(type=None, version=None, return_inactive=False):
datastore = type or CONF.default_datastore
if not datastore:
raise exception.DatastoreDefaultDatastoreNotFound()
@ -481,7 +481,7 @@ def get_datastore_version(type=None, version=None):
if datastore_version.datastore_id != datastore.id:
raise exception.DatastoreNoVersion(datastore=datastore.name,
version=datastore_version.name)
if not datastore_version.active:
if not datastore_version.active and not return_inactive:
raise exception.DatastoreVersionInactive(version=
datastore_version.name)
return (datastore, datastore_version)