summaryrefslogtreecommitdiff
path: root/troveclient/v1/instances.py
diff options
context:
space:
mode:
authorGreg Lucas <glucas@tesora.com>2014-08-29 22:58:04 -0400
committerGreg Lucas <glucas@tesora.com>2014-09-05 11:13:37 -0400
commitb287f672ac650defda96939945192af6df452136 (patch)
treefcd754338ccfa09204777fa1b0f61556fb63d0e0 /troveclient/v1/instances.py
parent6852bdcefc17712b4b57a530adfb406e059e52e2 (diff)
downloadpython-troveclient-b287f672ac650defda96939945192af6df452136.tar.gz
Use 'replica' instead of 'slave'
Replace the mysql-specific term 'slave' with the more general term 'replica'. In order to merge properly the client currently handles both 'slave' and 'replica' in certain cases. The 'slave' support will be removed completely once the trove runtime is updated to be in sync. Change-Id: Id22d18a84a4ac104ff8af09959e8eb2ae0102e97 Co-Authored-By: Nikhil Manchanda <SlickNik@gmail.com> Partial-Bug: 1360310
Diffstat (limited to 'troveclient/v1/instances.py')
-rw-r--r--troveclient/v1/instances.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/troveclient/v1/instances.py b/troveclient/v1/instances.py
index 2171333..9a10d87 100644
--- a/troveclient/v1/instances.py
+++ b/troveclient/v1/instances.py
@@ -47,11 +47,13 @@ class Instances(base.ManagerWithFind):
"""Manage :class:`Instance` resources."""
resource_class = Instance
+ # TODO(SlickNik): Remove slave_of param after updating tests to replica_of
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,
- slave_of=None):
+ replica_of=None, slave_of=None):
"""Create (boot) a new instance."""
+
body = {"instance": {
"name": name,
"flavorRef": flavor_id
@@ -77,8 +79,8 @@ class Instances(base.ManagerWithFind):
body["instance"]["nics"] = nics
if configuration:
body["instance"]["configuration"] = configuration
- if slave_of:
- body["instance"]["slave_of"] = slave_of
+ if replica_of or slave_of:
+ body["instance"]["replica_of"] = replica_of or slave_of
return self._create("/instances", body, "instance")
@@ -109,7 +111,10 @@ class Instances(base.ManagerWithFind):
if name is not None:
body["instance"]["name"] = name
if detach_replica_source:
+ # TODO(glucas): Remove slave_of after updating trove
+ # (see trove.instance.service.InstanceController#edit)
body["instance"]["slave_of"] = None
+ body["instance"]["replica_of"] = None
url = "/instances/%s" % instance_id
resp, body = self.api.client.patch(url, body=body)