config: allow to create VMs with unique names
This commit introduces option osapi_compute_unique_server_name_scope which allows operators to ensure VMs are created with unique names per project or cloud. Change-Id: Idacb60bb31cd60cb1deaec7cb3ec061f0c04da24 Closes-Bug: #1829782 Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
This commit is contained in:
parent
e38ce7bb71
commit
40282e0356
10
config.yaml
10
config.yaml
@ -617,3 +617,13 @@ options:
|
||||
.
|
||||
For Windows guests is recommended to set this to configuration option to
|
||||
False and for those images set the property hw_pointer_model=usbtablet
|
||||
unique-server-names:
|
||||
type: string
|
||||
default:
|
||||
description: |
|
||||
Sets the scope of the check for unique instance names.
|
||||
.
|
||||
An empty value (the default) means that no uniqueness check is done and
|
||||
duplicate names are possible. 'project': The instance name check is done
|
||||
only for instances within the same project. 'global': The instance name
|
||||
check is done for all instances regardless of the project.
|
||||
|
@ -404,6 +404,7 @@ class NovaConfigContext(ch_context.WorkerConfigContext):
|
||||
ctxt['console_access_port'] = hookenv.config('console-access-port')
|
||||
ctxt['scheduler_host_subset_size'] = hookenv.config(
|
||||
'scheduler-host-subset-size')
|
||||
ctxt['unique_server_names'] = hookenv.config('unique-server-names')
|
||||
return ctxt
|
||||
|
||||
|
||||
|
@ -24,6 +24,9 @@ auth_strategy=keystone
|
||||
compute_driver=libvirt.LibvirtDriver
|
||||
use_ipv6 = {{ use_ipv6 }}
|
||||
osapi_compute_listen = {{ bind_host }}
|
||||
{% if unique_server_names -%}
|
||||
osapi_compute_unique_unique_server_names = {{ unique_server_names }}
|
||||
{% endif -%}
|
||||
metadata_host = {{ bind_host }}
|
||||
s3_listen = {{ bind_host }}
|
||||
ec2_listen = {{ bind_host }}
|
||||
|
@ -24,6 +24,9 @@ auth_strategy=keystone
|
||||
compute_driver=libvirt.LibvirtDriver
|
||||
use_ipv6 = {{ use_ipv6 }}
|
||||
osapi_compute_listen = {{ bind_host }}
|
||||
{% if unique_server_names -%}
|
||||
osapi_compute_unique_unique_server_names = {{ unique_server_names }}
|
||||
{% endif -%}
|
||||
metadata_host = {{ bind_host }}
|
||||
s3_listen = {{ bind_host }}
|
||||
ec2_listen = {{ bind_host }}
|
||||
|
@ -23,6 +23,9 @@ auth_strategy=keystone
|
||||
compute_driver=libvirt.LibvirtDriver
|
||||
use_ipv6 = {{ use_ipv6 }}
|
||||
osapi_compute_listen = {{ bind_host }}
|
||||
{% if unique_server_names -%}
|
||||
osapi_compute_unique_unique_server_names = {{ unique_server_names }}
|
||||
{% endif -%}
|
||||
metadata_host = {{ bind_host }}
|
||||
s3_listen = {{ bind_host }}
|
||||
ec2_listen = {{ bind_host }}
|
||||
|
@ -22,6 +22,9 @@ auth_strategy=keystone
|
||||
compute_driver=libvirt.LibvirtDriver
|
||||
use_ipv6 = {{ use_ipv6 }}
|
||||
osapi_compute_listen = {{ bind_host }}
|
||||
{% if unique_server_names -%}
|
||||
osapi_compute_unique_unique_server_names = {{ unique_server_names }}
|
||||
{% endif -%}
|
||||
metadata_host = {{ bind_host }}
|
||||
s3_listen = {{ bind_host }}
|
||||
enable_new_services = {{ enable_new_services }}
|
||||
|
@ -22,6 +22,9 @@ auth_strategy=keystone
|
||||
compute_driver=libvirt.LibvirtDriver
|
||||
use_ipv6 = {{ use_ipv6 }}
|
||||
osapi_compute_listen = {{ bind_host }}
|
||||
{% if unique_server_names -%}
|
||||
osapi_compute_unique_unique_server_names = {{ unique_server_names }}
|
||||
{% endif -%}
|
||||
metadata_host = {{ bind_host }}
|
||||
s3_listen = {{ bind_host }}
|
||||
enable_new_services = {{ enable_new_services }}
|
||||
|
@ -19,6 +19,9 @@ enabled_apis=osapi_compute,metadata
|
||||
compute_driver=libvirt.LibvirtDriver
|
||||
use_ipv6 = {{ use_ipv6 }}
|
||||
osapi_compute_listen = {{ bind_host }}
|
||||
{% if unique_server_names -%}
|
||||
osapi_compute_unique_unique_server_names = {{ unique_server_names }}
|
||||
{% endif -%}
|
||||
metadata_host = {{ bind_host }}
|
||||
s3_listen = {{ bind_host }}
|
||||
enable_new_services = {{ enable_new_services }}
|
||||
|
@ -19,6 +19,9 @@ enabled_apis=osapi_compute,metadata
|
||||
compute_driver=libvirt.LibvirtDriver
|
||||
use_ipv6 = {{ use_ipv6 }}
|
||||
osapi_compute_listen = {{ bind_host }}
|
||||
{% if unique_server_names -%}
|
||||
osapi_compute_unique_unique_server_names = {{ unique_server_names }}
|
||||
{% endif -%}
|
||||
metadata_host = {{ bind_host }}
|
||||
s3_listen = {{ bind_host }}
|
||||
enable_new_services = {{ enable_new_services }}
|
||||
|
@ -19,6 +19,9 @@ enabled_apis=osapi_compute,metadata
|
||||
compute_driver=libvirt.LibvirtDriver
|
||||
use_ipv6 = {{ use_ipv6 }}
|
||||
osapi_compute_listen = {{ bind_host }}
|
||||
{% if unique_server_names -%}
|
||||
osapi_compute_unique_unique_server_names = {{ unique_server_names }}
|
||||
{% endif -%}
|
||||
metadata_host = {{ bind_host }}
|
||||
s3_listen = {{ bind_host }}
|
||||
enable_new_services = {{ enable_new_services }}
|
||||
|
@ -334,6 +334,7 @@ class NovaComputeContextTests(CharmTestCase):
|
||||
mock_config_ip.side_effect = self.test_config.get
|
||||
mock_unit_get.return_value = '127.0.0.1'
|
||||
self.test_config.set('scheduler-default-filters', 'TestFilter')
|
||||
self.test_config.set('unique-server-names', 'project')
|
||||
ctxt = context.NovaConfigContext()()
|
||||
self.assertEqual(ctxt['scheduler_default_filters'],
|
||||
self.config('scheduler-default-filters'))
|
||||
@ -379,6 +380,8 @@ class NovaComputeContextTests(CharmTestCase):
|
||||
self.config('console-access-protocol'))
|
||||
self.assertEqual(ctxt['console_access_port'],
|
||||
self.config('console-access-port'))
|
||||
self.assertEqual(ctxt['unique_server_names'],
|
||||
self.config('unique-server-names'))
|
||||
|
||||
_pci_alias1 = {
|
||||
"name": "IntelNIC",
|
||||
|
Loading…
Reference in New Issue
Block a user