1 # == Class: nova::compute
3 # Installs the nova-compute service
8 # (optional) Whether to enable the nova-compute service
12 # (optional) Whether to start/stop the service
16 # (optional) The state for the nova-compute package
17 # Defaults to 'present'
20 # (optional) Whether to use a VNC proxy
23 # [*vncserver_proxyclient_address*]
24 # (optional) The IP address of the server running the VNC proxy client
25 # Defaults to '127.0.0.1'
28 # (optional) The host of the VNC proxy server
31 # [*vncproxy_protocol*]
32 # (optional) The protocol to communicate with the VNC proxy server
36 # (optional) The port to communicate with the VNC proxy server
40 # (optional) The path at the end of the uri for communication with the VNC proxy server
41 # Defaults to '/vnc_auto.html'
44 # (optional) The keymap to use with VNC (ls -alh /usr/share/qemu/keymaps to list available keymaps)
47 # [*force_config_drive*]
48 # (optional) Whether to force the config drive to be attached to all VMs
52 # (optional) Whether to use virtio for the nic driver of VMs
56 # (optional) Whether to use Neutron for networking of VMs
59 # [*network_device_mtu*]
60 # (optional) The MTU size for the interfaces managed by nova
63 # [*instance_usage_audit*]
64 # (optional) Generate periodic compute.instance.exists notifications.
67 # [*instance_usage_audit_period*]
68 # (optional) Time period to generate instance usages for.
69 # Time period must be hour, day, month or year
72 # [*force_raw_images*]
73 # (optional) Force backing images to raw format.
76 # [*reserved_host_memory*]
77 # Reserved host memory
78 # The amount of memory in MB reserved for the host.
83 # The driver that will manage the running instances.
84 # Defaults to nova.compute.manager.ComputeManager
86 # [*pci_passthrough_whitelist*]
87 # (optional) Pci passthrough hash in format of:
90 # "[ { 'vendor_id':'1234','product_id':'5678' },
91 # { 'vendor_id':'4321','product_id':'8765','physical_network':'default' } ] "
93 # [*default_availability_zone*]
94 # (optional) Default compute node availability zone.
97 # [*default_schedule_zone*]
98 # (optional) Availability zone to use when user doesn't specify one.
101 # [*internal_service_availability_zone*]
102 # (optional) The availability zone to show internal services under.
103 # Defaults to internal
105 class nova::compute (
107 $manage_service = true,
108 $ensure_package = 'present',
110 $vncserver_proxyclient_address = '127.0.0.1',
111 $vncproxy_host = false,
112 $vncproxy_protocol = 'http',
113 $vncproxy_port = '6080',
114 $vncproxy_path = '/vnc_auto.html',
115 $vnc_keymap = 'en-us',
116 $force_config_drive = false,
118 $neutron_enabled = true,
119 $network_device_mtu = undef,
120 $instance_usage_audit = false,
121 $instance_usage_audit_period = 'month',
122 $force_raw_images = true,
123 $reserved_host_memory = '512',
124 $compute_manager = 'nova.compute.manager.ComputeManager',
125 $pci_passthrough = undef,
126 $default_availability_zone = 'nova',
127 $default_schedule_zone = undef,
128 $internal_service_availability_zone = 'internal',
134 'DEFAULT/reserved_host_memory_mb': value => $reserved_host_memory;
135 'DEFAULT/compute_manager': value => $compute_manager;
139 include ::nova::vncproxy::common
143 'DEFAULT/vnc_enabled': value => $vnc_enabled;
144 'DEFAULT/vncserver_proxyclient_address': value => $vncserver_proxyclient_address;
145 'DEFAULT/vnc_keymap': value => $vnc_keymap;
148 if $neutron_enabled != true {
149 # Install bridge-utils if we use nova-network
150 package { 'bridge-utils':
152 before => Nova::Generic_service['compute'],
156 nova::generic_service { 'compute':
158 manage_service => $manage_service,
159 package_name => $::nova::params::compute_package_name,
160 service_name => $::nova::params::compute_service_name,
161 ensure_package => $ensure_package,
162 before => Exec['networking-refresh']
165 if $force_config_drive {
166 nova_config { 'DEFAULT/force_config_drive': value => true }
168 nova_config { 'DEFAULT/force_config_drive': ensure => absent }
172 # Enable the virtio network card for instances
173 nova_config { 'DEFAULT/libvirt_use_virtio_for_bridges': value => true }
176 if $network_device_mtu {
178 'DEFAULT/network_device_mtu': value => $network_device_mtu;
182 'DEFAULT/network_device_mtu': ensure => absent;
186 if $instance_usage_audit and $instance_usage_audit_period in ['hour', 'day', 'month', 'year'] {
188 'DEFAULT/instance_usage_audit': value => $instance_usage_audit;
189 'DEFAULT/instance_usage_audit_period': value => $instance_usage_audit_period;
193 'DEFAULT/instance_usage_audit': ensure => absent;
194 'DEFAULT/instance_usage_audit_period': ensure => absent;
198 package { 'pm-utils':
203 'DEFAULT/force_raw_images': value => $force_raw_images;
206 if ($pci_passthrough) {
208 'DEFAULT/pci_passthrough_whitelist': value => check_array_of_hash($pci_passthrough);
213 'DEFAULT/default_availability_zone': value => $default_availability_zone;
214 'DEFAULT/internal_service_availability_zone': value => $internal_service_availability_zone;
217 if $default_schedule_zone {
219 'DEFAULT/default_schedule_zone': value => $default_schedule_zone;