Implement new option: enable_new_services

This change implements a new option in config.yaml that allows
services to come up disabled and be manually enabled later.

Change-Id: I345b56e347b63650ee3df07773ccb2e333610355
Closes-Bug: #1758776
This commit is contained in:
Andre Ruiz 2019-02-19 11:10:52 -03:00
parent 081bfba4a2
commit 5f21ea7124
12 changed files with 30 additions and 2 deletions

View File

@ -182,6 +182,22 @@ options:
Enable serial console access to instances using websockets (insecure).
This is only supported on OpenStack Juno or later, and will disable the
normal console-log output for an instance.
enable-new-services:
type: boolean
default: True
description: |
Enable new nova-compute services on this host automatically.
When a new nova-compute service starts up, it gets registered in the
database as an enabled service. Sometimes it can be useful to register
new compute services in disabled state and then enabled them at a later
point in time. This option only sets this behavior for nova-compute
services, it does not auto-disable other services like nova-conductor,
nova-scheduler, nova-consoleauth, or nova-osapi_compute.
Possible values: True: Each new compute service is enabled as soon as
it registers itself. False: Compute services must be enabled via an
os-services REST API call or with the CLI with
nova service-enable <hostname> <binary>, otherwise they are not ready
to use.
worker-multiplier:
type: float
default:

View File

@ -304,6 +304,7 @@ class NovaConfigContext(ch_context.WorkerConfigContext):
ctxt['disk_allocation_ratio'] = hookenv.config('disk-allocation-ratio')
ctxt['cpu_allocation_ratio'] = hookenv.config('cpu-allocation-ratio')
ctxt['ram_allocation_ratio'] = hookenv.config('ram-allocation-ratio')
ctxt['enable_new_services'] = hookenv.config('enable-new-services')
addr = ch_ip.resolve_address(ch_ip.INTERNAL)
ctxt['host_ip'] = ch_network_ip.format_ipv6_addr(addr) or addr
ctxt['quota_instances'] = hookenv.config('quota-instances')

View File

@ -27,6 +27,7 @@ osapi_compute_listen = {{ bind_host }}
metadata_host = {{ bind_host }}
s3_listen = {{ bind_host }}
ec2_listen = {{ bind_host }}
enable_new_services = {{ enable_new_services }}
osapi_compute_workers = {{ workers }}
ec2_workers = {{ workers }}

View File

@ -27,6 +27,7 @@ osapi_compute_listen = {{ bind_host }}
metadata_host = {{ bind_host }}
s3_listen = {{ bind_host }}
ec2_listen = {{ bind_host }}
enable_new_services = {{ enable_new_services }}
osapi_compute_workers = {{ workers }}
ec2_workers = {{ workers }}

View File

@ -26,6 +26,7 @@ osapi_compute_listen = {{ bind_host }}
metadata_host = {{ bind_host }}
s3_listen = {{ bind_host }}
ec2_listen = {{ bind_host }}
enable_new_services = {{ enable_new_services }}
osapi_compute_workers = {{ workers }}
ec2_workers = {{ workers }}

View File

@ -26,6 +26,7 @@ osapi_compute_listen = {{ bind_host }}
metadata_host = {{ bind_host }}
s3_listen = {{ bind_host }}
ec2_listen = {{ bind_host }}
enable_new_services = {{ enable_new_services }}
osapi_compute_workers = {{ workers }}
ec2_workers = {{ workers }}

View File

@ -24,6 +24,7 @@ use_ipv6 = {{ use_ipv6 }}
osapi_compute_listen = {{ bind_host }}
metadata_host = {{ bind_host }}
s3_listen = {{ bind_host }}
enable_new_services = {{ enable_new_services }}
osapi_compute_workers = {{ workers }}

View File

@ -24,6 +24,7 @@ use_ipv6 = {{ use_ipv6 }}
osapi_compute_listen = {{ bind_host }}
metadata_host = {{ bind_host }}
s3_listen = {{ bind_host }}
enable_new_services = {{ enable_new_services }}
osapi_compute_workers = {{ workers }}

View File

@ -21,6 +21,7 @@ use_ipv6 = {{ use_ipv6 }}
osapi_compute_listen = {{ bind_host }}
metadata_host = {{ bind_host }}
s3_listen = {{ bind_host }}
enable_new_services = {{ enable_new_services }}
{% if transport_url %}
transport_url = {{ transport_url }}
@ -232,4 +233,4 @@ server_groups = {{ quota_server_groups }}
{% endif -%}
{% if quota_server_group_members is not none -%}
server_group_members = {{ quota_server_group_members }}
{% endif -%}
{% endif -%}

View File

@ -21,6 +21,7 @@ use_ipv6 = {{ use_ipv6 }}
osapi_compute_listen = {{ bind_host }}
metadata_host = {{ bind_host }}
s3_listen = {{ bind_host }}
enable_new_services = {{ enable_new_services }}
{% if transport_url %}
transport_url = {{ transport_url }}
@ -239,4 +240,4 @@ server_groups = {{ quota_server_groups }}
{% endif -%}
{% if quota_server_group_members is not none -%}
server_group_members = {{ quota_server_group_members }}
{% endif -%}
{% endif -%}

View File

@ -21,6 +21,7 @@ use_ipv6 = {{ use_ipv6 }}
osapi_compute_listen = {{ bind_host }}
metadata_host = {{ bind_host }}
s3_listen = {{ bind_host }}
enable_new_services = {{ enable_new_services }}
{% if transport_url %}
transport_url = {{ transport_url }}

View File

@ -353,6 +353,8 @@ class NovaComputeContextTests(CharmTestCase):
self.assertEqual(ctxt['quota_server_group_members'],
self.config('quota-server-group-members'))
self.assertEqual(ctxt['quota_server_group_members'], None)
self.assertEqual(ctxt['enable_new_services'],
self.config('enable-new-services'))
_pci_alias1 = {
"name": "IntelNIC",