From e4c3b0ff1c96430efea3815135e07bbb8323d881 Mon Sep 17 00:00:00 2001 From: Marcus Furlong Date: Thu, 10 Mar 2016 01:18:27 +1100 Subject: [PATCH] cpu_allocation_ratio / ram_allocation_ratio options The cpu_allocation_ratio option allows specifying what the ratio of virtual CPUs to physical CPUs should be on a compute node. The ram_allocation_ratio option allows specifying what the ratio of virtual ram to to physical ram should be on a compute node. Change-Id: I13e0015589c4435cf34ec57c0bfad38cddc41e44 --- manifests/compute.pp | 14 ++++++++++++++ spec/classes/nova_compute_spec.rb | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/manifests/compute.pp b/manifests/compute.pp index 1474b0629..c3eb2cc26 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -113,6 +113,16 @@ # for virtual machine processes # Defaults to $::os_service_default # +# [*cpu_allocation_ratio*] +# (optional) Virtual CPU to physical CPU allocation ratio which +# affects all CPU filters. +# Defaults to $::os_service_default +# +# [*ram_allocation_ratio*] +# (optional) Virtual ram to physical ram allocation ratio which +# affects all ram filters. +# Defaults to $::os_service_default +# # DEPRECATED PARAMETERS # # [*default_availability_zone*] @@ -153,6 +163,8 @@ class nova::compute ( $config_drive_format = undef, $allow_resize_to_same_host = false, $vcpu_pin_set = $::os_service_default, + $cpu_allocation_ratio = $::os_service_default, + $ram_allocation_ratio = $::os_service_default, # DEPRECATED PARAMETERS $default_availability_zone = undef, $default_schedule_zone = undef, @@ -182,6 +194,8 @@ class nova::compute ( 'DEFAULT/heal_instance_info_cache_interval': value => $heal_instance_info_cache_interval; 'DEFAULT/allow_resize_to_same_host': value => $allow_resize_to_same_host; 'DEFAULT/vcpu_pin_set': value => join(any2array($vcpu_pin_set), ','); + 'DEFAULT/cpu_allocation_ratio': value => $cpu_allocation_ratio; + 'DEFAULT/ram_allocation_ratio': value => $ram_allocation_ratio; } if ($vnc_enabled) { diff --git a/spec/classes/nova_compute_spec.rb b/spec/classes/nova_compute_spec.rb index ee089f3ca..35ff295c9 100644 --- a/spec/classes/nova_compute_spec.rb +++ b/spec/classes/nova_compute_spec.rb @@ -61,6 +61,8 @@ describe 'nova::compute' do :pci_passthrough => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"physical_network\":\"physnet1\"}]", :config_drive_format => 'vfat', :vcpu_pin_set => ['4-12','^8','15'], + :cpu_allocation_ratio => '32.0', + :ram_allocation_ratio => '2.0', } end @@ -109,6 +111,10 @@ describe 'nova::compute' do it { is_expected.to contain_nova_config('DEFAULT/vcpu_pin_set').with(:value => '4-12,^8,15') } + it { is_expected.to contain_nova_config('DEFAULT/cpu_allocation_ratio').with(:value => '32.0') } + + it { is_expected.to contain_nova_config('DEFAULT/ram_allocation_ratio').with(:value => '2.0') } + it 'configures nova pci_passthrough_whitelist entries' do is_expected.to contain_nova_config('DEFAULT/pci_passthrough_whitelist').with( 'value' => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"physical_network\":\"physnet1\"}]"