Puppet Class: nova::compute::mdev

Defined in:
manifests/compute/mdev.pp

Overview

Class nova::compute::mdev

Configures nova compute mdev options

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 {}

Parameters:

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


12
13
14
15
16
17
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
54
55
# File 'manifests/compute/mdev.pp', line 12

class nova::compute::mdev(
  $mdev_types_device_addresses_mapping = {},
) {
  include nova::deps

  # TODO(tkajinam): Remove this when we remove nova::compute::vgpu
  $mdev_types_device_addresses_mapping_real = pick(
    $::nova::compute::vgpu::vgpu_types_device_addresses_mapping,
    $mdev_types_device_addresses_mapping)

  if !empty($mdev_types_device_addresses_mapping_real) {
    validate_legacy(Hash, 'validate_hash', $mdev_types_device_addresses_mapping_real)
    $mdev_types_real = keys($mdev_types_device_addresses_mapping_real)
    nova_config {
      'devices/enabled_mdev_types': value  => join(any2array($mdev_types_real), ',');
    }

    # TODO(tkajinam): Remove this when we remove nova::compute::vgpu
    nova_config {
      'devices/enabled_vgpu_types': ensure => absent;
    }

    $mdev_types_device_addresses_mapping_real.each |$mdev_type, $device_addresses| {
      if !empty($device_addresses) {
        nova_config {
          "mdev_${mdev_type}/device_addresses": value => join(any2array($device_addresses), ',');
        }

        # TODO(tkajinam): Remove this when we remove nova::compute::vgpu
        nova_config {
          "vgpu_${mdev_type}/device_addresses": ensure => absent;
        }
      } else {
        nova_config {
          "mdev_${mdev_type}/device_addresses": ensure => absent;
        }
      }
    }
  } else {
    nova_config {
      'devices/enabled_mdev_types': ensure => absent;
    }
  }
}