c4323951b94e5c5d0054448e0ca051b141249a5e
[mirror/dsa-puppet.git] / 3rdparty / modules / nova / manifests / scheduler / filter.pp
1 # == Class: nova:scheduler::filter
2 #
3 # This class is aim to configure nova.scheduler filter
4 #
5 # === Parameters:
6 #
7 # [*scheduler_host_manager*]
8 #   (optional) The scheduler host manager class to use
9 #   Defaults to 'nova.scheduler.host_manager.HostManager'
10 #
11 # [*scheduler_max_attempts*]
12 #   (optional) Maximum number of attempts to schedule an instance
13 #   Defaults to '3'
14 #
15 # [*scheduler_host_subset_size*]
16 #   (optional) defines the subset size that a host is chosen from
17 #   Defaults to '1'
18 #
19 # [*cpu_allocation_ratio*]
20 #   (optional) Virtual CPU to Physical CPU allocation ratio
21 #   Defaults to '16.0'
22 #
23 # [*disk_allocation_ratio*]
24 #   (optional) Virtual disk to physical disk allocation ratio
25 #   Defaults to '1.0'
26 #
27 # [*max_io_ops_per_host*]
28 #   (optional) Ignore hosts that have too many builds/resizes/snaps/migrations
29 #   Defaults to '8'
30 #
31 # [*isolated_images*]
32 #   (optional) Images to run on isolated host
33 #   Defaults to false
34 #
35 # [*isolated_hosts*]
36 #   (optional) Host reserved for specific images
37 #   Defaults to false
38 #
39 # [*max_instances_per_host*]
40 #   (optional) Ignore hosts that have too many instances
41 #   Defaults to '50'
42 #
43 # [*ram_allocation_ratio:*]
44 #   (optional) Virtual ram to physical ram allocation ratio
45 #   Defaults to '1.5'
46 #
47 # [*scheduler_available_filters*]
48 #   (optional) Filter classes available to the scheduler
49 #   Defaults to 'nova.scheduler.filters.all_filters'
50 #
51 # [*scheduler_default_filters*]
52 #   (optional) An array of filters to be used by default
53 #   Defaults to false
54 #
55 # [*scheduler_weight_classes*]
56 #   (optional) Which weight class names to use for weighing hosts
57 #   Defaults to 'nova.scheduler.weights.all_weighers'
58 #
59 class nova::scheduler::filter (
60   $scheduler_host_manager       = 'nova.scheduler.host_manager.HostManager',
61   $scheduler_max_attempts       = '3',
62   $scheduler_host_subset_size   = '1',
63   $cpu_allocation_ratio         = '16.0',
64   $disk_allocation_ratio        = '1.0',
65   $max_io_ops_per_host          = '8',
66   $max_instances_per_host       = '50',
67   $ram_allocation_ratio         = '1.5',
68   $isolated_images              = false,
69   $isolated_hosts               = false,
70   $scheduler_available_filters  = 'nova.scheduler.filters.all_filters',
71   $scheduler_default_filters    = false,
72   $scheduler_weight_classes     = 'nova.scheduler.weights.all_weighers',
73 ) {
74
75   nova_config {
76     'DEFAULT/scheduler_host_manager':       value => $scheduler_host_manager;
77     'DEFAULT/scheduler_max_attempts':       value => $scheduler_max_attempts;
78     'DEFAULT/scheduler_host_subset_size':   value => $scheduler_host_subset_size;
79     'DEFAULT/cpu_allocation_ratio':         value => $cpu_allocation_ratio;
80     'DEFAULT/disk_allocation_ratio':        value => $disk_allocation_ratio;
81     'DEFAULT/max_io_ops_per_host':          value => $max_io_ops_per_host;
82     'DEFAULT/max_instances_per_host':       value => $max_instances_per_host;
83     'DEFAULT/ram_allocation_ratio':         value => $ram_allocation_ratio;
84     'DEFAULT/scheduler_available_filters':  value => $scheduler_available_filters;
85     'DEFAULT/scheduler_weight_classes':     value => $scheduler_weight_classes
86   }
87   if ($scheduler_default_filters)  {
88     nova_config { 'DEFAULT/scheduler_default_filters':  value => join($scheduler_default_filters,',')
89     }
90   } else {
91     nova_config  { 'DEFAULT/scheduler_default_filters': ensure => absent
92     }
93   }
94   if ($isolated_images) {
95     nova_config {
96       'DEFAULT/isolated_images':    value => join($isolated_images,',')
97     }
98   } else {
99     nova_config {
100       'DEFAULT/isolated_images':   ensure => absent
101     }
102   }
103   if ($isolated_hosts) {
104     nova_config {
105       'DEFAULT/isolated_hosts':    value => join($isolated_hosts,',')
106     }
107   }  else {
108     nova_config {
109       'DEFAULT/isolated_hosts':    ensure => absent
110     }
111   }
112 }