summaryrefslogtreecommitdiff
path: root/troveclient/v1/instances.py
diff options
context:
space:
mode:
Diffstat (limited to 'troveclient/v1/instances.py')
-rw-r--r--troveclient/v1/instances.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/troveclient/v1/instances.py b/troveclient/v1/instances.py
index 8b01dbe..c0aa2cf 100644
--- a/troveclient/v1/instances.py
+++ b/troveclient/v1/instances.py
@@ -51,7 +51,7 @@ 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,
- replica_of=None, slave_of=None):
+ replica_of=None, slave_of=None, replica_count=None):
"""Create (boot) a new instance."""
body = {"instance": {
@@ -81,6 +81,8 @@ class Instances(base.ManagerWithFind):
body["instance"]["configuration"] = configuration
if replica_of or slave_of:
body["instance"]["replica_of"] = base.getid(replica_of) or slave_of
+ if replica_count:
+ body["instance"]["replica_count"] = replica_count
return self._create("/instances", body, "instance")
@@ -189,6 +191,24 @@ class Instances(base.ManagerWithFind):
return self._get("/instances/%s/configuration" % base.getid(instance),
"instance")
+ def promote_to_replica_source(self, instance):
+ """Promote a replica to be the new replica_source of its set
+
+ :param instance: The :class:`Instance` (or its ID) of the database
+ instance to promote.
+ """
+ body = {'promote_to_replica_source': {}}
+ self._action(instance, body)
+
+ def eject_replica_source(self, instance):
+ """Eject a replica source from its set
+
+ :param instance: The :class:`Instance` (or its ID) of the database
+ instance to eject.
+ """
+ body = {'eject_replica_source': {}}
+ self._action(instance, body)
+
class InstanceStatus(object):
@@ -200,3 +220,5 @@ class InstanceStatus(object):
RESIZE = "RESIZE"
SHUTDOWN = "SHUTDOWN"
RESTART_REQUIRED = "RESTART_REQUIRED"
+ PROMOTING = "PROMOTING"
+ EJECTING = "EJECTING"