Revert "Time to get rid of most vestiges of slave_of"

This reverts commit 0c94a5bae0

Removing 'slave_of' from the instance create API was a
backward incompatible change.

The parameter should be removed if/when trove has a new
version in their API, or adopts microversions.

This change depends on the change which reverts the
removal of slave_of from python-troveclient since
the tests depend on that argument being available in the
client.

Note that the tests could later be updated to no longer
use 'slave_of' to avoid a deprecation warning from the
client.

Conflicts:
        trove/tests/api/replication.py

NOTE(mriedem): The conflict was due to
5515c5291c.

Depends-On: I9b3ec6c101a89f30e61fc683808506c404e5474f

Change-Id: Ib6811293d99fbc20f6a52ee10de7c98bfb682b18
Partial-Bug: #1538506
This commit is contained in:
Matt Riedemann 2016-03-09 16:47:35 -05:00
parent f7cda9912d
commit cc18985814
4 changed files with 10 additions and 6 deletions

View File

@ -349,6 +349,7 @@ instance = {
"required": [],
"additionalProperties": False,
"properties": {
"slave_of": {},
"replica_of": {},
"name": non_empty_string,
"configuration": configuration_id,

View File

@ -260,7 +260,9 @@ class InstanceController(wsgi.Controller):
availability_zone = body['instance'].get('availability_zone')
nics = body['instance'].get('nics')
slave_of_id = body['instance'].get('replica_of')
slave_of_id = body['instance'].get('replica_of',
# also check for older name
body['instance'].get('slave_of'))
replica_count = body['instance'].get('replica_count')
instance = models.Instance.create(context, name, flavor_id,
image_id, databases, users,
@ -344,7 +346,8 @@ class InstanceController(wsgi.Controller):
instance = models.Instance.load(context, id)
args = {}
args['detach_replica'] = 'replica_of' in body['instance']
args['detach_replica'] = ('replica_of' in body['instance'] or
'slave_of' in body['instance'])
if 'name' in body['instance']:
args['name'] = body['instance']['name']

View File

@ -1583,7 +1583,7 @@ class CheckInstance(AttrCheck):
self.instance['volume'], allowed_attrs,
msg="Volume")
def replica_of(self):
def slave_of(self):
if 'replica_of' not in self.instance:
self.fail("'replica_of' not found in instance.")
else:

View File

@ -93,7 +93,7 @@ def create_slave():
nics=instance_info.nics,
datastore=instance_info.dbaas_datastore,
datastore_version=instance_info.dbaas_datastore_version,
replica_of=instance_info.id)
slave_of=instance_info.id)
assert_equal(200, instance_info.dbaas.last_http_code)
assert_equal("BUILD", result.status)
return result.id
@ -103,7 +103,7 @@ def validate_slave(master, slave):
new_slave = instance_info.dbaas.instances.get(slave.id)
assert_equal(200, instance_info.dbaas.last_http_code)
ns_dict = new_slave._info
CheckInstance(ns_dict).replica_of()
CheckInstance(ns_dict).slave_of()
assert_equal(master.id, ns_dict['replica_of']['id'])
@ -130,7 +130,7 @@ class CreateReplicationSlave(object):
instance_info.volume,
datastore=instance_info.dbaas_datastore,
datastore_version=instance_info.dbaas_datastore_version,
replica_of="Missing replica source")
slave_of="Missing replica source")
assert_equal(404, instance_info.dbaas.last_http_code)
@test