From ad88dc2a782b648cac1ace2806222d781c0bce85 Mon Sep 17 00:00:00 2001 From: Jan Klare Date: Mon, 16 Apr 2018 11:41:05 +0200 Subject: [PATCH] cleanup attribute leftovers that are not used anymore * removed all unused attributes * removed vmware specific configuration option that can be set in a wrapper cookbook (and was not maintained for quite some time) * removed caseswitch for nova user and group since we currently only support debian and rhel * moved all libvirtd related config options to specific attribute file in preparation for further refactoring Change-Id: I42a0bbcd03a570b9d6d24ba32ed2cafacc33ec76 --- attributes/default.rb | 96 ++----------------------------------- attributes/libvirtd_conf.rb | 16 +++++++ recipes/nova-common.rb | 8 +--- spec/nova-common_spec.rb | 29 ----------- 4 files changed, 20 insertions(+), 129 deletions(-) create mode 100644 attributes/libvirtd_conf.rb diff --git a/attributes/default.rb b/attributes/default.rb index c65987d2..326e9092 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -12,34 +12,20 @@ default['openstack']['compute']['custom_template_banner'] = ' # Any changes will be overwritten ' -# The name of the Chef role that knows about the message queue server -# that Nova uses -default['openstack']['compute']['rabbit_server_chef_role'] = 'os-ops-messaging' - # Set dbsync command timeout value default['openstack']['compute']['dbsync_timeout'] = 3600 -# The name of the Chef role that sets up the Keystone Service API -default['openstack']['compute']['identity_service_chef_role'] = 'os-identity' - # Disallow non-encrypted connections default['openstack']['compute']['service_role'] = 'admin' -case node['platform_family'] -when 'rhel', 'debian' - default['openstack']['compute']['user'] = 'nova' - default['openstack']['compute']['group'] = 'nova' -end +# Used to set correct permissions for directories and files +default['openstack']['compute']['user'] = 'nova' +default['openstack']['compute']['group'] = 'nova' # Logging stuff - default['openstack']['compute']['syslog']['facility'] = 'LOG_LOCAL1' default['openstack']['compute']['syslog']['config_facility'] = 'local1' -default['openstack']['compute']['region'] = node['openstack']['region'] - -default['openstack']['compute']['floating_cmd'] = '/usr/local/bin/add_floaters.py' - # rootwrap.conf default['openstack']['compute']['rootwrap']['filters_path'] = '/etc/nova/rootwrap.d,/usr/share/nova/rootwrap' default['openstack']['compute']['rootwrap']['exec_dirs'] = '/sbin,/usr/sbin,/bin,/usr/bin' @@ -47,75 +33,6 @@ default['openstack']['compute']['rootwrap']['use_syslog'] = 'False' default['openstack']['compute']['rootwrap']['syslog_log_facility'] = 'syslog' default['openstack']['compute']['rootwrap']['syslog_log_level'] = 'ERROR' -default['openstack']['compute']['driver'] = 'libvirt.LibvirtDriver' - -# libvirtd_opts used in template for /etc/default/libvirt-bin -default['openstack']['compute']['libvirt']['libvirtd_opts'] = '-l' - -default['openstack']['compute']['libvirt']['auth_tcp'] = 'none' -# libvirt.max_clients (default: 20) -default['openstack']['compute']['libvirt']['max_clients'] = 20 -# libvirt.max_workers (default: 20) -default['openstack']['compute']['libvirt']['max_workers'] = 20 -# libvirt.max_requests (default: 20) -default['openstack']['compute']['libvirt']['max_requests'] = 20 -# libvirt.max_client_requests (default: 5) -default['openstack']['compute']['libvirt']['max_client_requests'] = 5 -default['openstack']['compute']['libvirt']['group'] = 'libvirt' -default['openstack']['compute']['libvirt']['unix_sock_rw_perms'] = '0770' -default['openstack']['compute']['libvirt']['libvirt_inject_key'] = true -default['openstack']['compute']['libvirt']['volume_backend'] = nil - -# Base URL that will be presented to users in links -# to the OpenStack Compute API -default['openstack']['compute']['config']['osapi_compute_link_prefix'] = nil -# Base URL that will be presented to users in links -# to glance resources -default['openstack']['compute']['config']['osapi_glance_link_prefix'] = nil -default['openstack']['compute']['config']['cpu_allocation_ratio'] = 16.0 - -# `start` will cause nova-compute to error out if a VM is already running, where -# `resume` checks to see if it is running first. -# requires https://review.openstack.org/#/c/8423/ -default['openstack']['compute']['config']['resume_guests_state_on_host_boot'] = true - -default['openstack']['compute']['ratelimit']['settings'] = { - 'generic-post-limit' => { 'verb' => 'POST', 'uri' => '*', 'regex' => '.*', 'limit' => '10', 'interval' => 'MINUTE' }, - 'create-servers-limit' => { 'verb' => 'POST', 'uri' => '*/servers', 'regex' => '^/servers', 'limit' => '50', 'interval' => 'DAY' }, - 'generic-put-limit' => { 'verb' => 'PUT', 'uri' => '*', 'regex' => '.*', 'limit' => '10', 'interval' => 'MINUTE' }, - 'changes-since-limit' => { 'verb' => 'GET', 'uri' => '*changes-since*', 'regex' => '.*changes-since.*', 'limit' => '3', 'interval' => 'MINUTE' }, - 'generic-delete-limit' => { 'verb' => 'DELETE', 'uri' => '*', 'regex' => '.*', 'limit' => '100', 'interval' => 'MINUTE' }, -} - -# Metering settings -default['openstack']['compute']['metering'] = false #### - -# Notification settings -default['openstack']['compute']['config']['notification_topics'] = ['notifications'] - -if node['openstack']['compute']['metering'] - default['openstack']['compute']['config']['notification_drivers'] = ['nova.openstack.common.notifier.rpc_notifier', 'ceilometer.compute.nova_notifier'] - default['openstack']['compute']['config']['instance_usage_audit'] = 'True' - default['openstack']['compute']['config']['instance_usage_audit_period'] = 'hour' - default['openstack']['compute']['config']['notify_on_state_change'] = 'vm_and_task_state' -else - default['openstack']['compute']['config']['notification_drivers'] = [] - default['openstack']['compute']['config']['instance_usage_audit'] = 'False' - default['openstack']['compute']['config']['instance_usage_audit_period'] = 'month' - default['openstack']['compute']['config']['notify_on_state_change'] = '' -end - -# Monitor settings -default['openstack']['compute']['config']['compute_available_monitors'] = ['nova.compute.monitors.all_monitors'] - -# Keystone settings -default['openstack']['compute']['api']['auth_strategy'] = 'keystone' - -default['openstack']['compute']['api']['auth']['version'] = node['openstack']['api']['auth']['version'] - -# A PEM encoded Certificate Authority to use when verifying HTTPs connections. -default['openstack']['compute']['api']['auth']['cafile'] = nil - # Placement API settings default['openstack']['placement']['ssl']['enabled'] = false default['openstack']['placement']['ssl']['certfile'] = '' @@ -202,13 +119,6 @@ end # Array of options for `api-paste.ini` (e.g. ['option1=value1', ...]) default['openstack']['compute']['misc_paste'] = nil -# NOTE: The metadata api service is enabled via including it's recipe -# NOTE: api-metadata. By default the api-metadata recipe is included in -# NOTE: the os-compute-api role which is included in the -# NOTE: os-compute-single-controller role. - -# For true case, this logic allows the following ironic-related attribtes to be overwritten automatically. - # ****************** OpenStack Compute Endpoints ****************************** # The OpenStack Compute (Nova) XVPvnc endpoint diff --git a/attributes/libvirtd_conf.rb b/attributes/libvirtd_conf.rb new file mode 100644 index 00000000..fa9b8380 --- /dev/null +++ b/attributes/libvirtd_conf.rb @@ -0,0 +1,16 @@ +# libvirtd_opts used in template for /etc/default/libvirt-bin +default['openstack']['compute']['libvirt']['libvirtd_opts'] = '-l' + +default['openstack']['compute']['libvirt']['auth_tcp'] = 'none' +# libvirt.max_clients (default: 20) +default['openstack']['compute']['libvirt']['max_clients'] = 20 +# libvirt.max_workers (default: 20) +default['openstack']['compute']['libvirt']['max_workers'] = 20 +# libvirt.max_requests (default: 20) +default['openstack']['compute']['libvirt']['max_requests'] = 20 +# libvirt.max_client_requests (default: 5) +default['openstack']['compute']['libvirt']['max_client_requests'] = 5 +default['openstack']['compute']['libvirt']['group'] = 'libvirt' +default['openstack']['compute']['libvirt']['unix_sock_rw_perms'] = '0770' +default['openstack']['compute']['libvirt']['libvirt_inject_key'] = true +default['openstack']['compute']['libvirt']['volume_backend'] = nil diff --git a/recipes/nova-common.rb b/recipes/nova-common.rb index 87b6fdc6..69918316 100644 --- a/recipes/nova-common.rb +++ b/recipes/nova-common.rb @@ -144,13 +144,7 @@ node.default['openstack']['compute']['conf_secrets'] .[]('neutron')['metadata_proxy_shared_secret'] = get_password 'token', 'neutron_metadata_secret' -if node['openstack']['compute']['driver'].split('.').first == 'vmwareapi' - node.default['openstack']['compute']['conf_secrets'] - .[]('vmware')['host_password'] = - get_password 'token', 'openstack_vmware_secret_name' -end - -auth_url = auth_uri_transform identity_endpoint.to_s, node['openstack']['compute']['api']['auth']['version'] +auth_url = auth_uri_transform identity_endpoint.to_s, node['openstack']['api']['auth']['version'] node.default['openstack']['compute']['conf_secrets'] .[]('keystone_authtoken')['password'] = get_password 'service', 'openstack-compute' diff --git a/spec/nova-common_spec.rb b/spec/nova-common_spec.rb index 80ca857b..a721a055 100644 --- a/spec/nova-common_spec.rb +++ b/spec/nova-common_spec.rb @@ -232,35 +232,6 @@ describe 'openstack-compute::nova-common' do .with_section_content('cinder', /^os_region_name = RegionOne$/) end - context 'vmware' do - before do - # README(galstrom21): There is a order of operations issue here - # if you use node.set, these tests will fail. - node.override['openstack']['compute']['driver'] = 'vmwareapi.VMwareVCDriver' - # NB(srenatus) this is only one option, the other one is - # 'vmwareapi.VMwareESXDriver' (see templates/default/nova.conf.erb) - end - - it 'has vmware config options set' do - [ - /^host_password = vmware_secret_name$/, - ].each do |line| - expect(chef_run).to render_config_file(file.name)\ - .with_section_content('vmware', line) - end - end - - it 'has no datastore_regex line' do - expect(chef_run).not_to render_config_file(file.name)\ - .with_section_content('vmware', 'datastore_regex = ') - end - - it 'has no wsdl_location line' do - expect(chef_run).not_to render_config_file(file.name)\ - .with_section_content('vmware', 'wsdl_location = ') - end - end - it 'has no auto_assign_floating_ip' do expect(chef_run).not_to render_file(file.name).with_content( 'auto_assign_floating_ip=false'