diff options
author | Greg Lucas <glucas@tesora.com> | 2014-06-04 11:17:37 -0400 |
---|---|---|
committer | Greg Lucas <glucas@tesora.com> | 2014-06-10 08:38:42 -0400 |
commit | 258b47b2a06915d17079a57a4243a8141ee50d71 (patch) | |
tree | bf6c78417d4935952fe017b2b151a64ce0bdfb72 | |
parent | a48272cb2dfc39d96cbf9f4ba26cee8745720deb (diff) | |
download | python-troveclient-258b47b2a06915d17079a57a4243a8141ee50d71.tar.gz |
Add 'slave_of' option for enabling replication
Add a new create option (--slave_of) that can be used to enable
replication and configure the newly created instance as a slave of the
specified existing instance.
DocImpact Introduces new option when creating an instance.
partially Implements: blueprint replication-v1
Change-Id: Idf22d3d9e676138969cbdf3afd4903b8e475c313
-rw-r--r-- | troveclient/v1/instances.py | 5 | ||||
-rw-r--r-- | troveclient/v1/shell.py | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/troveclient/v1/instances.py b/troveclient/v1/instances.py index 1b53ccb..aef6da4 100644 --- a/troveclient/v1/instances.py +++ b/troveclient/v1/instances.py @@ -45,7 +45,8 @@ class Instances(base.ManagerWithFind): def create(self, name, flavor_id, volume=None, databases=None, users=None, restorePoint=None, availability_zone=None, datastore=None, - datastore_version=None, nics=None, configuration=None): + datastore_version=None, nics=None, configuration=None, + slave_of=None): """Create (boot) a new instance.""" body = {"instance": { "name": name, @@ -72,6 +73,8 @@ class Instances(base.ManagerWithFind): body["instance"]["nics"] = nics if configuration: body["instance"]["configuration"] = configuration + if slave_of: + body["instance"]["slave_of"] = slave_of return self._create("/instances", body, "instance") diff --git a/troveclient/v1/shell.py b/troveclient/v1/shell.py index 6f1abde..04b0c6e 100644 --- a/troveclient/v1/shell.py +++ b/troveclient/v1/shell.py @@ -218,6 +218,10 @@ def do_update(cs, args): metavar='<configuration>', default=None, help='ID of the configuration group to attach to the instance.') +@utils.arg('--slave_of', + metavar='<master_id>', + default=None, + help='ID of an existing instance to replicate from.') @utils.service_type('database') def do_create(cs, args): """Creates a new instance.""" @@ -251,7 +255,8 @@ def do_create(cs, args): datastore=args.datastore, datastore_version=args.datastore_version, nics=nics, - configuration=args.configuration) + configuration=args.configuration, + slave_of=args.slave_of) if hasattr(instance, 'configuration'): instance._info['configuration'] = instance.configuration['id'] instance._info['flavor'] = instance.flavor['id'] |