Puppet Class: nova::compute::vgpu

Defined in:
manifests/compute/vgpu.pp

Overview

Parameters:

  • vgpu_types_device_addresses_mapping (Any) (defaults to: {})
  • enabled_vgpu_types (Any) (defaults to: undef)


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
56
57
58
59
60
61
62
# File 'manifests/compute/vgpu.pp', line 19

class nova::compute::vgpu(
  $vgpu_types_device_addresses_mapping      = {},
  # DEPRECATED PARAMETERS
  $enabled_vgpu_types                       = undef,
) {
  include nova::deps

  if $enabled_vgpu_types {
    warning('enabled_vgpu_types is deprecated, instead use vgpu_types_device_addresses_mapping parameter.')

    if !empty($vgpu_types_device_addresses_mapping) {
      warning('vgpu_types_device_addresses_mapping is ignored, when both enabled_vgpu_types \
and vgpu_types_device_addresses_mapping are defined.')
    }
  }

  if $enabled_vgpu_types != undef and !empty($enabled_vgpu_types) {
    nova_config {
      'devices/enabled_vgpu_types': value => join(any2array($enabled_vgpu_types), ',');
    }
  } elsif !empty($vgpu_types_device_addresses_mapping) {
    validate_legacy(Hash, 'validate_hash', $vgpu_types_device_addresses_mapping)
    $vgpu_types_real = keys($vgpu_types_device_addresses_mapping)
    nova_config {
      'devices/enabled_vgpu_types': value => join(any2array($vgpu_types_real), ',');
    }

    $vgpu_types_device_addresses_mapping.each |$vgpu_type, $device_addresses| {
      if !empty($device_addresses) {
        nova_config {
          "vgpu_${vgpu_type}/device_addresses": value => join(any2array($device_addresses), ',');
        }
      } else {
        nova_config {
          "vgpu_${vgpu_type}/device_addresses": ensure => absent;
        }
      }
    }
  } else {
    nova_config {
      'devices/enabled_vgpu_types': ensure => absent;
    }
  }
}