diff options
author | Zuul <zuul@review.openstack.org> | 2018-07-18 06:21:52 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2018-07-18 06:21:52 +0000 |
commit | 3adf5fe392102c088b72c4dac6f10eaf1f0e7983 (patch) | |
tree | 6585b675b0b24b020be00c2c90cf875de104f3e5 /troveclient/osc/v1/database_instances.py | |
parent | 048dd502fa8273e138cf76b752e39a912b16d534 (diff) | |
parent | 3f705bd0c828ef60dcae9d1621dcc7b95e9f21b9 (diff) | |
download | python-troveclient-2.16.0.tar.gz |
Diffstat (limited to 'troveclient/osc/v1/database_instances.py')
-rw-r--r-- | troveclient/osc/v1/database_instances.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/troveclient/osc/v1/database_instances.py b/troveclient/osc/v1/database_instances.py index 96ec7c7..3bb6a74 100644 --- a/troveclient/osc/v1/database_instances.py +++ b/troveclient/osc/v1/database_instances.py @@ -533,6 +533,29 @@ class ForceDeleteDatabaseInstance(command.Command): raise exceptions.CommandError(msg) +class PromoteDatabaseInstanceToReplicaSource(command.Command): + + _description = _( + "Promotes a replica to be the new replica source of its set.") + + def get_parser(self, prog_name): + parser = super(PromoteDatabaseInstanceToReplicaSource, + self).get_parser(prog_name) + parser.add_argument( + 'instance', + metavar='<instance>', + type=str, + help=_('ID or name of the instance.'), + ) + return parser + + def take_action(self, parsed_args): + db_instances = self.app.client_manager.database.instances + instance = osc_utils.find_resource(db_instances, + parsed_args.instance) + db_instances.promote_to_replica_source(instance) + + class RestartDatabaseInstance(command.Command): _description = _("Restarts an instance.") |