Puppet Class: nova::compute::mdev

Defined in:
manifests/compute/mdev.pp

Overview

Class nova::compute::mdev

Configures nova compute mdev options

Parameters:

mdev_types

(Optional) A hash to define the nova::compute::mdev_type resources. Defaults to {}

DEPRECATED PARAMETERS

mdev_types_device_addresses_mapping

(Optional) Map of mdev type(s) the instances can get as key and list of corresponding device addresses as value. Defaults to undef

Parameters:

  • mdev_types (Any) (defaults to: {})
  • mdev_types_device_addresses_mapping (Any) (defaults to: undef)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'manifests/compute/mdev.pp', line 18

class nova::compute::mdev(
  $mdev_types                          = {},
  # DEPRECATED PARAMETERS
  $mdev_types_device_addresses_mapping = undef,
) {
  include nova::deps

  validate_legacy(Hash, 'validate_hash', $mdev_types)
  if $mdev_types_device_addresses_mapping != undef {
    warning('mdev_types_device_addresses_mapping is deprecated. Use mdev_types.')
    validate_legacy(Hash, 'validate_hash', $mdev_types_device_addresses_mapping)
  }

  $dev_addr_mapping_real = pick_default($mdev_types_device_addresses_mapping, {})

  if !empty($dev_addr_mapping_real) {
    nova_config {
      'devices/enabled_mdev_types': value => join(keys($dev_addr_mapping_real), ',');
    }

    $dev_addr_mapping_real.each |$mdev_type, $device_addresses| {
      nova::compute::mdev_type { $mdev_type :
        device_addresses => $device_addresses;
      }
    }
  } elsif !empty($mdev_types) {
    nova_config {
      'devices/enabled_mdev_types': value => join(keys($mdev_types), ',')
    }
    create_resources('nova::compute::mdev_type', $mdev_types)
  } else {
    nova_config {
      'devices/enabled_mdev_types': ensure => absent;
    }
  }
}