Browse Source

Use StrOpt for instance type

The instance type ID can be a string for quite sometime (such as
a UUID by default).

Change-Id: Iad9f742c1dd2dfc9b99f0756123af0cf51389c55
(cherry picked from commit e224b83d7e)
changes/48/706748/1
Mohammed Naser 3 weeks ago
parent
commit
9ff0d6d9fb
3 changed files with 8 additions and 8 deletions
  1. +1
    -1
      doc/source/configuration/tables/manila-generic.inc
  2. +2
    -2
      manila/share/drivers/service_instance.py
  3. +5
    -5
      manila/tests/share/drivers/test_service_instance.py

+ 1
- 1
doc/source/configuration/tables/manila-generic.inc View File

@@ -49,7 +49,7 @@
* - ``service_image_name`` = ``manila-service-image``
- (String) Name of image in Glance, that will be used for service instance creation. Only used if driver_handles_share_servers=True.
* - ``service_instance_flavor_id`` = ``100``
- (Integer) ID of flavor, that will be used for service instance creation. Only used if driver_handles_share_servers=True.
- (String) ID of flavor, that will be used for service instance creation. Only used if driver_handles_share_servers=True.
* - ``service_instance_name_or_id`` = ``None``
- (String) Name or ID of service instance in Nova to use for share exports. Used only when share servers handling is disabled.
* - ``service_instance_name_template`` = ``manila_service_instance_%s``


+ 2
- 2
manila/share/drivers/service_instance.py View File

@@ -67,9 +67,9 @@ share_servers_handling_mode_opts = [
help="Security group name, that will be used for "
"service instance creation. "
"Only used if driver_handles_share_servers=True."),
cfg.IntOpt(
cfg.StrOpt(
"service_instance_flavor_id",
default=100,
default="100",
help="ID of flavor, that will be used for service instance "
"creation. Only used if driver_handles_share_servers=True."),
cfg.StrOpt(


+ 5
- 5
manila/tests/share/drivers/test_service_instance.py View File

@@ -48,7 +48,7 @@ def fake_get_config_option(key):
elif key == 'service_network_name':
return 'fake_service_network_name'
elif key == 'service_instance_flavor_id':
return 100
return '100'
elif key == 'service_instance_name_template':
return 'fake_manila_service_instance_%s'
elif key == 'service_image_name':
@@ -1094,7 +1094,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
allow_ssh_subnet=network_data['service_subnet'])
self._manager.compute_api.server_create.assert_called_once_with(
self._manager.admin_context, name=instance_name,
image=service_image_id, flavor=100,
image=service_image_id, flavor='100',
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(
@@ -1176,7 +1176,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
allow_ssh_subnet=network_data['service_subnet'])
self._manager.compute_api.server_create.assert_called_once_with(
self._manager.admin_context, name=instance_name,
image=service_image_id, flavor=100,
image=service_image_id, flavor='100',
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(
@@ -1236,7 +1236,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
self._manager.admin_context)
self._manager.compute_api.server_create.assert_called_once_with(
self._manager.admin_context, name=instance_name,
image=service_image_id, flavor=100,
image=service_image_id, flavor='100',
key_name=key_data[0], nics=network_data['nics'],
availability_zone=service_instance.CONF.storage_availability_zone)

@@ -1331,7 +1331,7 @@ class ServiceInstanceManagerTestCase(test.TestCase):
self._manager.admin_context)
self._manager.compute_api.server_create.assert_called_once_with(
self._manager.admin_context, name=instance_name,
image=service_image_id, flavor=100,
image=service_image_id, flavor='100',
key_name=key_data[0], nics=network_data['nics'],
availability_zone=service_instance.CONF.storage_availability_zone)



Loading…
Cancel
Save