2 # Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
4 # Author: Emilien Macchi <emilien.macchi@enovance.com>
5 # François Charlier <francois.charlier@enovance.com>
7 # Licensed under the Apache License, Version 2.0 (the "License"); you may
8 # not use this file except in compliance with the License. You may obtain
9 # a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16 # License for the specific language governing permissions and limitations
19 # The nova::cells class installs the Nova Cells
23 # Use Nova Cells or not
27 # (optional) Whether to start/stop the service
31 # Create cells with nova-manage
35 # Cells communication driver to use
36 # Defaults to 'nova.cells.rpc_driver.CellsRPCDriver'
38 # [*instance_updated_at_threshold*]
39 # Number of seconds after an instance was updated or deleted to continue to update cells
43 # Maximum number of hops for cells routing
47 # Cells scheduler to use
48 # Defaults to 'nova.cells.scheduler.CellsScheduler'
50 # [*instance_update_num_instances*]
51 # Number of instances to update per periodic task run
55 # Number of instances to update per periodic task run
56 # Defaults to 'nova.cells.manager.CellsManager'
62 # [*cell_parent_name*]
63 # * If a child cell, this is the name of the 'parent' cell.
64 # * If a parent cell, should be left to undef.
67 # Key/Multi-value list with the capabilities of the cell
68 # Defaults to 'hypervisor=xenserver;kvm,os=linux;windows'
71 # Seconds to wait for response from a call to a cell
75 # Percentage of cell capacity to hold in reserve. Affects both memory and disk utilization
79 # Type of cell: parent or child
82 # [*mute_child_interval*]
83 # Number of seconds after which a lack of capability and
84 # capacity updates signals the child cell is to be treated as a mute
87 # [*bandwidth_update_interval*]
88 # Seconds between bandwidth updates for cells
91 # [*rpc_driver_queue_base*]
92 # Base queue name to use when communicating between cells
93 # Various topics by message type will be appended to this
94 # Defaults to 'cells.intercell'
96 # [*scheduler_filter_classes*]
97 # Filter classes the cells scheduler should use
98 # Defaults to 'nova.cells.filters.all_filters'
100 # [*scheduler_weight_classes*]
101 # Weigher classes the cells scheduler should use
102 # Defaults to 'nova.cells.weights.all_weighers'
104 # [*scheduler_retries*]
105 # How many retries when no cells are available
108 # [*scheduler_retry_delay*]
109 # How often to retry in seconds when no cells are available
112 # [*db_check_interval*]
113 # Seconds between getting fresh cell info from db
116 # [*mute_weight_multiplier*]
117 # Multiplier used to weigh mute children (The value should be negative)
118 # Defaults to '-10.0'
120 # [*mute_weight_value*]
121 # Weight value assigned to mute children (The value should be positive)
122 # Defaults to '1000.0'
124 # [*ram_weight_multiplier*]
125 # Multiplier used for weighing ram. Negative numbers mean to stack vs spread
129 # It might be used by some cell scheduling code in the future
133 # It might be used by some cell scheduling code in the future
138 $bandwidth_update_interval = '600',
139 $call_timeout = '60',
140 $capabilities = ['hypervisor=xenserver;kvm','os=linux;windows'],
143 $cell_parent_name = undef,
144 $create_cells = true,
145 $db_check_interval = '60',
146 $driver = 'nova.cells.rpc_driver.CellsRPCDriver',
148 $ensure_package = 'present',
149 $instance_updated_at_threshold = '3600',
150 $instance_update_num_instances = '1',
151 $manage_service = true,
152 $manager = 'nova.cells.manager.CellsManager',
153 $max_hop_count = '10',
154 $mute_child_interval = '300',
155 $mute_weight_multiplier = '-10.0',
156 $mute_weight_value = '1000.0',
157 $ram_weight_multiplier = '10.0',
158 $reserve_percent = '10.0',
159 $rpc_driver_queue_base = 'cells.intercell',
160 $scheduler_filter_classes = 'nova.cells.filters.all_filters',
161 $scheduler = 'nova.cells.scheduler.CellsScheduler',
162 $scheduler_retries = '10',
163 $scheduler_retry_delay = '2',
164 $scheduler_weight_classes = 'nova.cells.weights.all_weighers',
165 $weight_offset = '1.0',
166 $weight_scale = '1.0'
173 nova_config { 'DEFAULT/compute_api_class': value => 'nova.compute.cells_api.ComputeCellsAPI' }
174 nova_config { 'cells/cell_type': value => 'api' }
177 nova_config { 'DEFAULT/quota_driver': value => 'nova.quota.NoopQuotaDriver' }
178 nova_config { 'cells/cell_type': value => 'compute' }
180 default: { fail("Unsupported cell_type parameter value: '${cell_type}'. Should be 'parent' or 'child'.") }
184 'cells/bandwidth_update_interval': value => $bandwidth_update_interval;
185 'cells/call_timeout': value => $call_timeout;
186 'cells/capabilities': value => join($capabilities, ',');
187 'cells/db_check_interval': value => $db_check_interval;
188 'cells/driver': value => $driver;
189 'cells/enable': value => $enabled;
190 'cells/instance_updated_at_threshold': value => $instance_updated_at_threshold;
191 'cells/instance_update_num_instances': value => $instance_update_num_instances;
192 'cells/manager': value => $manager;
193 'cells/max_hop_count': value => $max_hop_count;
194 'cells/mute_child_interval': value => $mute_child_interval;
195 'cells/mute_weight_multiplier': value => $mute_weight_multiplier;
196 'cells/mute_weight_value': value => $mute_weight_value;
197 'cells/name': value => $cell_name;
198 'cells/ram_weight_multiplier': value => $ram_weight_multiplier;
199 'cells/reserve_percent': value => $reserve_percent;
200 'cells/rpc_driver_queue_base': value => $rpc_driver_queue_base;
201 'cells/scheduler_filter_classes': value => $scheduler_filter_classes;
202 'cells/scheduler_retries': value => $scheduler_retries;
203 'cells/scheduler_retry_delay': value => $scheduler_retry_delay;
204 'cells/scheduler': value => $scheduler;
205 'cells/scheduler_weight_classes': value => $scheduler_weight_classes;
208 nova::generic_service { 'cells':
210 manage_service => $manage_service,
211 package_name => $::nova::params::cells_package_name,
212 service_name => $::nova::params::cells_service_name,
213 ensure_package => $ensure_package,
217 @@nova::manage::cells { $cell_name:
218 cell_type => $cell_type,
219 cell_parent_name => $cell_parent_name,
220 rabbit_username => $::nova::rabbit_userid,
221 rabbit_password => $::nova::rabbit_password,
222 rabbit_hosts => $::nova::rabbit_hosts,
223 rabbit_port => $::nova::rabbit_port,
224 rabbit_virtual_host => $::nova::rabbit_virtual_host,
225 weight_offset => $weight_offset,
226 weight_scale => $weight_scale,
227 before => Service['cells']
232 # A parent cell must declare its child cell(s)
233 Nova::Manage::Cells <<| cell_parent_name == $cell_parent_name and cell_type == 'child' |>>
236 # A child cell must declare its parent cell
237 Nova::Manage::Cells <<| name == $cell_parent_name and cell_type == 'parent' |>>
240 fail("Invalid cell_type parameter value: ${cell_type}")