diff --git a/config.yaml b/config.yaml index 127c88b0..3aefdb52 100644 --- a/config.yaml +++ b/config.yaml @@ -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 , otherwise they are not ready + to use. worker-multiplier: type: float default: diff --git a/hooks/nova_cc_context.py b/hooks/nova_cc_context.py index 159d205d..1029dc53 100644 --- a/hooks/nova_cc_context.py +++ b/hooks/nova_cc_context.py @@ -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') diff --git a/templates/icehouse/nova.conf b/templates/icehouse/nova.conf index 66a78cea..b05096d3 100644 --- a/templates/icehouse/nova.conf +++ b/templates/icehouse/nova.conf @@ -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 }} diff --git a/templates/juno/nova.conf b/templates/juno/nova.conf index 66ec1a0d..2fde0ff2 100644 --- a/templates/juno/nova.conf +++ b/templates/juno/nova.conf @@ -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 }} diff --git a/templates/kilo/nova.conf b/templates/kilo/nova.conf index fa7f7058..05a64eaf 100644 --- a/templates/kilo/nova.conf +++ b/templates/kilo/nova.conf @@ -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 }} diff --git a/templates/liberty/nova.conf b/templates/liberty/nova.conf index 63de0bf2..c5e10344 100644 --- a/templates/liberty/nova.conf +++ b/templates/liberty/nova.conf @@ -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 }} diff --git a/templates/mitaka/nova.conf b/templates/mitaka/nova.conf index 72ef2922..d63990e3 100644 --- a/templates/mitaka/nova.conf +++ b/templates/mitaka/nova.conf @@ -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 }} diff --git a/templates/newton/nova.conf b/templates/newton/nova.conf index 72f6d745..e0500b5f 100644 --- a/templates/newton/nova.conf +++ b/templates/newton/nova.conf @@ -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 }} diff --git a/templates/ocata/nova.conf b/templates/ocata/nova.conf index c00918ad..b1623b63 100644 --- a/templates/ocata/nova.conf +++ b/templates/ocata/nova.conf @@ -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 -%} \ No newline at end of file +{% endif -%} diff --git a/templates/pike/nova.conf b/templates/pike/nova.conf index 5fbbb5b8..b44615db 100644 --- a/templates/pike/nova.conf +++ b/templates/pike/nova.conf @@ -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 -%} \ No newline at end of file +{% endif -%} diff --git a/templates/rocky/nova.conf b/templates/rocky/nova.conf index 594225e3..32cc368a 100644 --- a/templates/rocky/nova.conf +++ b/templates/rocky/nova.conf @@ -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 }} diff --git a/unit_tests/test_nova_cc_contexts.py b/unit_tests/test_nova_cc_contexts.py index 7e1ae1df..bd6820af 100644 --- a/unit_tests/test_nova_cc_contexts.py +++ b/unit_tests/test_nova_cc_contexts.py @@ -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",