diff options
author | Peter Stachowski <peter@tesora.com> | 2016-04-01 21:25:12 +0000 |
---|---|---|
committer | Peter Stachowski <peter@tesora.com> | 2016-06-20 19:38:48 +0000 |
commit | 187725fafb3952cf17b5109acb06a414a39790e2 (patch) | |
tree | af2a198f3831ca6f52a7013feb521d80a1637505 /trove/tests/unittests/taskmanager/test_models.py | |
parent | 9147f9dd6b3e86b004b613daae7581b9a68ab9db (diff) | |
download | trove-187725fafb3952cf17b5109acb06a414a39790e2.tar.gz |
Locality support for replication
In order to allow replication sets to be all on the same hypervisor
(affinity) or all on different hypervisors (anti-affinity) a new
argument (locality) needed to be added to the Trove create API.
This changeset addresses the Trove server part of this feature.
'locality' can now be added to the ReST payload for a create command
and it is passed along as a scheduler hint to Nova.
The replication scenario tests were enhanced to test that 'affinity'
works and 'anti-affinity' fails (since devstack sets up a single
hypervisor by default). A check for the existance (and
lack of) server-groups was added. This is to ensure that not only is
the server-group created properly, but also that it has been deleted
after all the related instances are gone.
DocImpact: New functionality
Partially implements: blueprint replication-cluster-locality
Depends-On: I18f242983775526a7f1e2644302ebdc0dac025cf
Change-Id: I7d924c25d832f9ff4386e9497bfd214f1b2b3503
Diffstat (limited to 'trove/tests/unittests/taskmanager/test_models.py')
-rw-r--r-- | trove/tests/unittests/taskmanager/test_models.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/trove/tests/unittests/taskmanager/test_models.py b/trove/tests/unittests/taskmanager/test_models.py index ac1cfc71..6f875d0a 100644 --- a/trove/tests/unittests/taskmanager/test_models.py +++ b/trove/tests/unittests/taskmanager/test_models.py @@ -81,7 +81,8 @@ class fake_Server: class fake_ServerManager: def create(self, name, image_id, flavor_id, files, userdata, security_groups, block_device_mapping, availability_zone=None, - nics=None, config_drive=False): + nics=None, config_drive=False, + scheduler_hints=None): server = fake_Server() server.id = "server_id" server.name = name @@ -380,7 +381,7 @@ class FreshInstanceTasksTest(trove_testtools.TestCase): 'Error creating security group for instance', self.freshinstancetasks.create_instance, mock_flavor, 'mysql-image-id', None, None, 'mysql', 'mysql-server', 2, - None, None, None, None, Mock(), None, None, None, None) + None, None, None, None, Mock(), None, None, None, None, None) @patch.object(BaseInstance, 'update_db') @patch.object(backup_models.Backup, 'get_by_id') @@ -402,7 +403,7 @@ class FreshInstanceTasksTest(trove_testtools.TestCase): self.freshinstancetasks.create_instance, mock_flavor, 'mysql-image-id', None, None, 'mysql', 'mysql-server', 2, Mock(), None, 'root_password', None, Mock(), None, None, None, - None) + None, None) @patch.object(BaseInstance, 'update_db') @patch.object(taskmanager_models.FreshInstanceTasks, '_create_dns_entry') @@ -417,6 +418,8 @@ class FreshInstanceTasksTest(trove_testtools.TestCase): mock_guest_prepare, mock_build_volume_info, mock_create_secgroup, + mock_create_server, + mock_get_injected_files, *args): mock_flavor = {'id': 8, 'ram': 768, 'name': 'bigger_flavor'} config_content = {'config_contents': 'some junk'} @@ -428,13 +431,18 @@ class FreshInstanceTasksTest(trove_testtools.TestCase): 'mysql-server', 2, None, None, None, None, overrides, None, None, - 'volume_type', None) + 'volume_type', None, + {'group': 'sg-id'}) mock_create_secgroup.assert_called_with('mysql') mock_build_volume_info.assert_called_with('mysql', volume_size=2, volume_type='volume_type') mock_guest_prepare.assert_called_with( 768, mock_build_volume_info(), 'mysql-server', None, None, None, config_content, None, overrides, None, None, None) + mock_create_server.assert_called_with( + 8, 'mysql-image-id', mock_create_secgroup(), + 'mysql', mock_build_volume_info()['block_device'], None, + None, mock_get_injected_files(), {'group': 'sg-id'}) @patch.object(trove.guestagent.api.API, 'attach_replication_slave') @patch.object(rpc, 'get_client') |