Merge "Fix replication creation"
This commit is contained in:
commit
721866f6ed
@ -144,7 +144,7 @@ def instance_delete(request, instance_id):
|
|||||||
return troveclient(request).instances.delete(instance_id)
|
return troveclient(request).instances.delete(instance_id)
|
||||||
|
|
||||||
|
|
||||||
def instance_create(request, name, volume, flavor, databases=None,
|
def instance_create(request, name, volume, flavor=None, databases=None,
|
||||||
users=None, restore_point=None, nics=None,
|
users=None, restore_point=None, nics=None,
|
||||||
datastore=None, datastore_version=None,
|
datastore=None, datastore_version=None,
|
||||||
replica_of=None, replica_count=None,
|
replica_of=None, replica_count=None,
|
||||||
@ -152,12 +152,19 @@ def instance_create(request, name, volume, flavor, databases=None,
|
|||||||
availability_zone=None):
|
availability_zone=None):
|
||||||
# TODO(dklyle): adding conditional to support trove without volume
|
# TODO(dklyle): adding conditional to support trove without volume
|
||||||
# support for now until API supports checking for volume support
|
# support for now until API supports checking for volume support
|
||||||
if volume > 0:
|
if volume > 0 and not replica_of:
|
||||||
volume_params = {'size': volume}
|
volume_params = {'size': volume}
|
||||||
if volume_type:
|
if volume_type:
|
||||||
volume_params['type'] = volume_type
|
volume_params['type'] = volume_type
|
||||||
else:
|
else:
|
||||||
volume_params = None
|
volume_params = None
|
||||||
|
|
||||||
|
if replica_of:
|
||||||
|
flavor = None
|
||||||
|
volume_params = None
|
||||||
|
datastore = None
|
||||||
|
datastore_version = None
|
||||||
|
|
||||||
return troveclient(request).instances.create(
|
return troveclient(request).instances.create(
|
||||||
name,
|
name,
|
||||||
flavor,
|
flavor,
|
||||||
|
@ -1256,7 +1256,7 @@ class DatabaseTests(test.TestCase):
|
|||||||
mock.call(request)]
|
mock.call(request)]
|
||||||
self.assertEqual(expected_calls,
|
self.assertEqual(expected_calls,
|
||||||
self.mock_instance_list.call_args_list)
|
self.mock_instance_list.call_args_list)
|
||||||
self.assertTrue(len(choices) == len(self.databases.list()) + 1)
|
self.assertEqual(len(choices), len(self.databases.list()) + 1)
|
||||||
|
|
||||||
def _build_datastore_display_text(self, datastore, datastore_version):
|
def _build_datastore_display_text(self, datastore, datastore_version):
|
||||||
return datastore + ' - ' + datastore_version
|
return datastore + ' - ' + datastore_version
|
||||||
|
@ -435,7 +435,7 @@ class AdvancedAction(workflows.Action):
|
|||||||
try:
|
try:
|
||||||
instances = self._get_instances()
|
instances = self._get_instances()
|
||||||
choices = sorted([(i.id, i.name) for i in
|
choices = sorted([(i.id, i.name) for i in
|
||||||
instances if i.status == 'ACTIVE'],
|
instances if i.status == 'HEALTHY'],
|
||||||
key=lambda i: i[1])
|
key=lambda i: i[1])
|
||||||
except Exception:
|
except Exception:
|
||||||
choices = []
|
choices = []
|
||||||
@ -489,6 +489,7 @@ class AdvancedAction(workflows.Action):
|
|||||||
raise forms.ValidationError(
|
raise forms.ValidationError(
|
||||||
_("A master instance must be selected!"))
|
_("A master instance must be selected!"))
|
||||||
|
|
||||||
|
cleaned_data['flavor'] = None
|
||||||
cleaned_data['backup'] = None
|
cleaned_data['backup'] = None
|
||||||
else:
|
else:
|
||||||
cleaned_data['master'] = None
|
cleaned_data['master'] = None
|
||||||
|
@ -140,7 +140,7 @@ CLUSTER_DATA_TWO = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DATABASE_DATA_ONE = {
|
DATABASE_DATA_ONE = {
|
||||||
"status": "ACTIVE",
|
"status": "HEALTHY",
|
||||||
"updated": "2013-08-12T22:00:09",
|
"updated": "2013-08-12T22:00:09",
|
||||||
"name": "Test Database",
|
"name": "Test Database",
|
||||||
"links": [],
|
"links": [],
|
||||||
@ -165,7 +165,7 @@ DATABASE_DATA_ONE = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DATABASE_DATA_TWO = {
|
DATABASE_DATA_TWO = {
|
||||||
"status": "ACTIVE",
|
"status": "HEALTHY",
|
||||||
"updated": "2013-08-12T22:00:09",
|
"updated": "2013-08-12T22:00:09",
|
||||||
"name": "Test Database With DNS",
|
"name": "Test Database With DNS",
|
||||||
"links": [],
|
"links": [],
|
||||||
@ -187,7 +187,7 @@ DATABASE_DATA_TWO = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DATABASE_DATA_THREE = {
|
DATABASE_DATA_THREE = {
|
||||||
"status": "ACTIVE",
|
"status": "HEALTHY",
|
||||||
"updated": "2015-01-12T22:00:09",
|
"updated": "2015-01-12T22:00:09",
|
||||||
"name": "Test Database with Config",
|
"name": "Test Database with Config",
|
||||||
"links": [],
|
"links": [],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user