From 6e054ff49ba0a6c87ac3d89fcb04eb5d7c236f5d Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Thu, 6 Aug 2015 16:21:01 +0300 Subject: [PATCH] Use service availability_zone for Share Server VM Update ServiceInstanceManager to respect AZ when creating Nova VM's. Partially-Implements: blueprint availability-zones Change-Id: I5c734a6b82c4eec189951ba35e076e36699e1c10 --- manila/share/drivers/service_instance.py | 1 + manila/tests/share/drivers/test_service_instance.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/manila/share/drivers/service_instance.py b/manila/share/drivers/service_instance.py index ce6921c660..39bea8d0f9 100644 --- a/manila/share/drivers/service_instance.py +++ b/manila/share/drivers/service_instance.py @@ -516,6 +516,7 @@ class ServiceInstanceManager(object): flavor=self.get_config_option("service_instance_flavor_id"), key_name=key_name, nics=network_data['nics'], + availability_zone=CONF.storage_availability_zone, **create_kwargs) fail_safe_data['instance_id'] = service_instance['id'] diff --git a/manila/tests/share/drivers/test_service_instance.py b/manila/tests/share/drivers/test_service_instance.py index 0703cf937b..ff8450c43a 100644 --- a/manila/tests/share/drivers/test_service_instance.py +++ b/manila/tests/share/drivers/test_service_instance.py @@ -1009,7 +1009,8 @@ class ServiceInstanceManagerTestCase(test.TestCase): self._manager.compute_api.server_create.assert_called_once_with( self._manager.admin_context, name=instance_name, image=service_image_id, flavor=100, - key_name=key_data[0], nics=network_data['nics']) + key_name=key_data[0], nics=network_data['nics'], + availability_zone=service_instance.CONF.storage_availability_zone) self._manager.compute_api.server_get.assert_called_once_with( self._manager.admin_context, server_create['id']) if helper_type == service_instance.NEUTRON_NAME: @@ -1075,7 +1076,8 @@ class ServiceInstanceManagerTestCase(test.TestCase): self._manager.compute_api.server_create.assert_called_once_with( self._manager.admin_context, name=instance_name, image=service_image_id, flavor=100, - key_name=key_data[0], nics=network_data['nics']) + key_name=key_data[0], nics=network_data['nics'], + availability_zone=service_instance.CONF.storage_availability_zone) def test___create_service_instance_failed_to_build(self): server_create = dict(id='fakeid', status='CREATING', networks=dict()) @@ -1119,7 +1121,8 @@ class ServiceInstanceManagerTestCase(test.TestCase): self._manager.compute_api.server_create.assert_called_once_with( self._manager.admin_context, name=instance_name, image=service_image_id, flavor=100, - key_name=key_data[0], nics=network_data['nics']) + key_name=key_data[0], nics=network_data['nics'], + availability_zone=service_instance.CONF.storage_availability_zone) @ddt.data( dict(name=None, path=None),