From c7ecebdb1fe2d3fc1ba022c5d99747c349cd70f1 Mon Sep 17 00:00:00 2001 From: Mark Vanderwiel Date: Thu, 26 Jun 2014 11:40:09 -0500 Subject: [PATCH] Allow scheduler_available_filters and compute_manager overrides Change-Id: I0bfddec245a0f0be21372a1353effd17567be572 Closes-Bug: #1334754 --- CHANGELOG.md | 1 + README.md | 2 ++ Strainerfile | 2 +- attributes/default.rb | 2 ++ spec/nova-common_spec.rb | 10 ++++++++++ templates/default/nova.conf.erb | 4 ++-- 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f13d39fb..989a001e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ This file is used to list changes made in each version of cookbook-openstack-com ## 9.3.1 * Move auth configuration from api-paste.ini to nova.conf * fix fauxhai version for suse and redhat +* Allow scheduler_available_filters and compute_manager to have attribute overrides ## 9.3.0 * python_packages database client attributes have been migrated to the -common cookbook diff --git a/README.md b/README.md index 9ba45b99..a2a6c899 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ Openstack Compute attributes are in the attribute namespace ["openstack"]["compu * `openstack["compute"]["metadata_workers"]` - Number of metadata workders * `openstack["compute"]["config"]["volume_api_class"]` - API Class used for Volume support * `openstack['compute']['driver'] = Driver to use for controlling virtualization +* `openstack['compute']['manager'] = Full class name for the Manager for compute * `openstack['compute']['default_ephemeral_format'] = The default format an ephemeral_volume will be formatted with on creation * `openstack['compute']['preallocate_images'] = VM image preallocation mode * `openstack['compute']['use_cow_images'] = Whether to use cow images @@ -254,6 +255,7 @@ Scheduler Configuration Attributes * `openstack["compute"]["scheduler"]["scheduler_driver"]` - the scheduler driver to use NOTE: The filter scheduler currently does not work with ec2. +* `openstack["compute"]["scheduler"]["available_filters"]` - Filter classes available to the scheduler which may be specified more than once. * `openstack["compute"]["scheduler"]["default_filters"]` - a list of filters enabled for schedulers that support them. Syslog Configuration Attributes diff --git a/Strainerfile b/Strainerfile index cf2ff52d..1c9a3e06 100644 --- a/Strainerfile +++ b/Strainerfile @@ -2,4 +2,4 @@ rubocop: rubocop $SANDBOX/$COOKBOOK knife test: knife cookbook test $COOKBOOK foodcritic: foodcritic -f any -t ~FC003 -t ~FC023 $SANDBOX/$COOKBOOK -chefspec: rspec $SANDBOX/$COOKBOOK/spec +chefspec: rspec --format documentation $SANDBOX/$COOKBOOK/spec diff --git a/attributes/default.rb b/attributes/default.rb index cc3510d1..ee995d42 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -169,6 +169,7 @@ default['openstack']['compute']['network']['use_single_default_gateway'] = false default['openstack']['compute']['network']['use_ipv6'] = false default['openstack']['compute']['scheduler']['scheduler_driver'] = 'nova.scheduler.filter_scheduler.FilterScheduler' +default['openstack']['compute']['scheduler']['available_filters'] = 'nova.scheduler.filters.all_filters' default['openstack']['compute']['scheduler']['default_filters'] = %W( AvailabilityZoneFilter RamFilter @@ -178,6 +179,7 @@ default['openstack']['compute']['scheduler']['default_filters'] = %W( DifferentHostFilter) default['openstack']['compute']['driver'] = 'libvirt.LibvirtDriver' +default['openstack']['compute']['manager'] = 'nova.compute.manager.ComputeManager' default['openstack']['compute']['default_ephemeral_format'] = nil default['openstack']['compute']['preallocate_images'] = 'none' default['openstack']['compute']['use_cow_images'] = true diff --git a/spec/nova-common_spec.rb b/spec/nova-common_spec.rb index f4af4680..3e7baef9 100644 --- a/spec/nova-common_spec.rb +++ b/spec/nova-common_spec.rb @@ -89,6 +89,7 @@ describe 'openstack-compute::nova-common' do it 'has compute driver attributes defaults set' do [/^compute_driver=libvirt.LibvirtDriver$/, + /^compute_manager=nova.compute.manager.ComputeManager$/, /^preallocate_images=none$/, /^use_cow_images=true$/, /^vif_plugging_is_fatal=true$/, @@ -460,6 +461,15 @@ describe 'openstack-compute::nova-common' do end end + it 'has scheduler options' do + [/^compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler$/, + /^scheduler_available_filters=nova.scheduler.filters.all_filters$/, + /^scheduler_default_filters=AvailabilityZoneFilter,RamFilter,ComputeFilter,CoreFilter,SameHostFilter,DifferentHostFilter$/ + ].each do |line| + expect(chef_run).to render_file(file.name).with_content(line) + end + end + it 'has disk_allocation_ratio when the right filter is set' do node.set['openstack']['compute']['scheduler']['default_filters'] = %w( AvailabilityZoneFilter diff --git a/templates/default/nova.conf.erb b/templates/default/nova.conf.erb index b2f17cbe..7d3e4e52 100644 --- a/templates/default/nova.conf.erb +++ b/templates/default/nova.conf.erb @@ -73,7 +73,7 @@ qpid_topology_version=<%= node['openstack']['mq']['compute']['qpid']['topology_v ##### SCHEDULER ##### # scheduler_manager=nova.scheduler.manager.SchedulerManager compute_scheduler_driver=<%= node["openstack"]["compute"]["scheduler"]["scheduler_driver"] %> -scheduler_available_filters=nova.scheduler.filters.all_filters +scheduler_available_filters=<%= node["openstack"]["compute"]["scheduler"]["available_filters"] %> # which filter class names to use for filtering hosts when not specified in the request. scheduler_default_filters=<%= @scheduler_default_filters %> default_availability_zone=<%= node["openstack"]["compute"]["config"]["availability_zone"] %> @@ -137,7 +137,7 @@ preallocate_images=<%= node["openstack"]["compute"]["preallocate_images"] %> use_cow_images=<%= node["openstack"]["compute"]["use_cow_images"] %> vif_plugging_is_fatal=<%= node["openstack"]["compute"]["vif_plugging_is_fatal"] %> vif_plugging_timeout=<%= node["openstack"]["compute"]["vif_plugging_timeout"] %> -compute_manager=nova.compute.manager.ComputeManager +compute_manager=<%= node["openstack"]["compute"]["manager"] %> sql_connection=<%= @sql_connection %> connection_type=libvirt