diff options
author | Zuul <zuul@review.opendev.org> | 2021-06-03 12:39:41 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-06-03 12:39:41 +0000 |
commit | bdd76b34dc485c16a8ec861e135b330be5272c54 (patch) | |
tree | 6e9d69308a9b2e910c09ac49bc108132fb6b73b7 | |
parent | 313e6ee3c102551585b9ae4088a58a805a494163 (diff) | |
parent | ac8fd38e5e3a16e00b5dc6aef4c6c1666989a3ba (diff) | |
download | trove-bdd76b34dc485c16a8ec861e135b330be5272c54.tar.gz |
Merge "Don't create nova instances with fqdn as their name"
-rwxr-xr-x | trove/taskmanager/models.py | 3 | ||||
-rw-r--r-- | trove/tests/unittests/taskmanager/test_models.py | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/trove/taskmanager/models.py b/trove/taskmanager/models.py index a918073e..5be6f08c 100755 --- a/trove/taskmanager/models.py +++ b/trove/taskmanager/models.py @@ -982,13 +982,12 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin): metadata = {'trove_project_id': self.tenant_id, 'trove_user_id': self.context.user, 'trove_instance_id': self.id} - name = self.hostname or self.name bdmap_v2 = block_device_mapping_v2 config_drive = CONF.use_nova_server_config_drive key_name = CONF.nova_keypair server = self.nova_client.servers.create( - name, image_id, flavor_id, key_name=key_name, nics=nics, + self.name, image_id, flavor_id, key_name=key_name, nics=nics, block_device_mapping_v2=bdmap_v2, files=files, userdata=userdata, availability_zone=availability_zone, diff --git a/trove/tests/unittests/taskmanager/test_models.py b/trove/tests/unittests/taskmanager/test_models.py index b81194a3..b5ea9814 100644 --- a/trove/tests/unittests/taskmanager/test_models.py +++ b/trove/tests/unittests/taskmanager/test_models.py @@ -304,7 +304,12 @@ class FreshInstanceTasksTest(BaseFreshInstanceTasksTest): @patch.object(taskmanager_models.FreshInstanceTasks, 'hostname', new_callable=PropertyMock, return_value='fake-hostname') - def test_servers_create_block_device_mapping_v2(self, mock_hostname): + @patch.object(taskmanager_models.FreshInstanceTasks, 'name', + new_callable=PropertyMock, + return_value='fake-name') + def test_servers_create_block_device_mapping_v2(self, + mock_hostname, + mock_name): self.freshinstancetasks.prepare_userdata = Mock(return_value=None) mock_nova_client = self.freshinstancetasks.nova_client = Mock() mock_servers_create = mock_nova_client.servers.create @@ -314,7 +319,7 @@ class FreshInstanceTasksTest(BaseFreshInstanceTasksTest): 'trove_user_id': 'test_user', 'trove_instance_id': self.freshinstancetasks.id} mock_servers_create.assert_called_with( - 'fake-hostname', 'fake-image', + 'fake-name', 'fake-image', 'fake-flavor', files={}, userdata=None, block_device_mapping_v2=None, |