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
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -74,11 +74,11 @@ def _print_instance(instance):
|
||||
info['datastore_version'] = instance.datastore['version']
|
||||
if hasattr(instance, 'configuration'):
|
||||
info['configuration'] = instance.configuration['id']
|
||||
if hasattr(instance, 'slave_of'):
|
||||
info['slave_of'] = instance.slave_of['id']
|
||||
if hasattr(instance, 'slaves'):
|
||||
slaves = [slave['id'] for slave in instance.slaves]
|
||||
info['slaves'] = ', '.join(slaves)
|
||||
if hasattr(instance, 'replica_of'):
|
||||
info['replica_of'] = instance.replica_of['id']
|
||||
if hasattr(instance, 'replicas'):
|
||||
replicas = [replica['id'] for replica in instance.replicas]
|
||||
info['replicas'] = ', '.join(replicas)
|
||||
info.pop('links', None)
|
||||
utils.print_dict(info)
|
||||
|
||||
@@ -318,8 +318,8 @@ 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>',
|
||||
@utils.arg('--replica_of',
|
||||
metavar='<source_id>',
|
||||
default=None,
|
||||
help='ID of an existing instance to replicate from.')
|
||||
@utils.service_type('database')
|
||||
@@ -356,7 +356,7 @@ def do_create(cs, args):
|
||||
datastore_version=args.datastore_version,
|
||||
nics=nics,
|
||||
configuration=args.configuration,
|
||||
slave_of=args.slave_of)
|
||||
replica_of=args.replica_of)
|
||||
_print_instance(instance)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user