File: pci.pp

package info (click to toggle)
puppet-module-nova 27.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,068 kB
  • sloc: ruby: 11,144; python: 33; makefile: 10; sh: 10
file content (51 lines) | stat: -rw-r--r-- 1,469 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
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
# Class nova::compute::pci
#
# Configures nova compute pci options
#
# === Parameters:
#
#  [*device_specs*]
#   (optional) Specify the PCI devices available to VMs.
#   Defaults to []
#   Example of format:
#   [ { "vendor_id" => "1234","product_id" => "5678" },
#     { "vendor_id" => "4321","product_id" => "8765", "physical_network" => "default" } ]
#
#  [*report_in_placement*]
#   (optional) Enable PCI resource inventory reporting to Placement.
#   Defaults to $facts['os_service_default']
#
# DEPRECATED PARAMETERS
#
#  [*passthrough*]
#   (optional) Pci passthrough list of hash.
#   Defaults to undef
#
class nova::compute::pci (
  Array[Hash] $device_specs          = [],
  $report_in_placement               = $facts['os_service_default'],
  # DEPRECATED PARAMETERS
  Optional[Array[Hash]] $passthrough = undef,
) {
  include nova::deps

  if $passthrough != undef {
    warning('The passthrough parameter is deprecated. Use the device_specs parameter.')
    if empty($passthrough) {
      $device_specs_real = $facts['os_service_default']
    } else {
      $device_specs_real = to_array_of_json_strings($passthrough)
    }
  } else {
    if empty($device_specs) {
      $device_specs_real = $facts['os_service_default']
    } else {
      $device_specs_real = to_array_of_json_strings($device_specs)
    }
  }

  nova_config {
    'pci/device_spec':         value => $device_specs_real;
    'pci/report_in_placement': value => $report_in_placement;
  }
}