Rename nova::compute::pci::paththrough
... to make the naming consistent with the actual option name in nova ([pci] device_spec). Change-Id: I7b5ec4669b47192a799f8dcc3672082547e25d76
This commit is contained in:
@@ -4,8 +4,8 @@
|
|||||||
#
|
#
|
||||||
# === Parameters:
|
# === Parameters:
|
||||||
#
|
#
|
||||||
# [*passthrough*]
|
# [*device_specs*]
|
||||||
# (optional) Pci passthrough list of hash.
|
# (optional) Specify the PCI devices available to VMs.
|
||||||
# Defaults to $facts['os_service_default']
|
# Defaults to $facts['os_service_default']
|
||||||
# Example of format:
|
# Example of format:
|
||||||
# [ { "vendor_id" => "1234","product_id" => "5678" },
|
# [ { "vendor_id" => "1234","product_id" => "5678" },
|
||||||
@@ -15,20 +15,37 @@
|
|||||||
# (optional) Enable PCI resource inventory reporting to Placement.
|
# (optional) Enable PCI resource inventory reporting to Placement.
|
||||||
# Defaults to $facts['os_service_default']
|
# Defaults to $facts['os_service_default']
|
||||||
#
|
#
|
||||||
|
# DEPRECATED PARAMETERS
|
||||||
|
#
|
||||||
|
# [*passthrough*]
|
||||||
|
# (optional) Pci passthrough list of hash.
|
||||||
|
# Defaults to undef
|
||||||
|
#
|
||||||
class nova::compute::pci(
|
class nova::compute::pci(
|
||||||
$passthrough = $facts['os_service_default'],
|
$device_specs = $facts['os_service_default'],
|
||||||
$report_in_placement = $facts['os_service_default'],
|
$report_in_placement = $facts['os_service_default'],
|
||||||
|
# DEPRECATED PARAMETERS
|
||||||
|
$passthrough = undef,
|
||||||
) {
|
) {
|
||||||
include nova::deps
|
include nova::deps
|
||||||
|
|
||||||
if !is_service_default($passthrough) and !empty($passthrough) {
|
if $passthrough != undef {
|
||||||
$passthrough_real = to_array_of_json_strings($passthrough)
|
warning('The passthrough parameter is deprecated. Use the device_specs parameter.')
|
||||||
|
if empty($passthrough) or is_service_default($passthrough) {
|
||||||
|
$device_specs_real = $facts['os_service_default']
|
||||||
} else {
|
} else {
|
||||||
$passthrough_real = $facts['os_service_default']
|
$device_specs_real = to_array_of_json_strings($passthrough)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if empty($device_specs) or is_service_default($device_specs) {
|
||||||
|
$device_specs_real = $facts['os_service_default']
|
||||||
|
} else {
|
||||||
|
$device_specs_real = to_array_of_json_strings($device_specs)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nova_config {
|
nova_config {
|
||||||
'pci/device_spec': value => $passthrough_real;
|
'pci/device_spec': value => $device_specs_real;
|
||||||
'pci/report_in_placement': value => $report_in_placement;
|
'pci/report_in_placement': value => $report_in_placement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
deprecations:
|
||||||
|
- |
|
||||||
|
The ``nova::compute::pci::passthrough`` parameter has been deprecated in
|
||||||
|
favor of the new ``device_specs`` parameter.
|
@@ -22,10 +22,10 @@ describe 'nova::compute::pci' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with passthrough array' do
|
context 'with device_specs array' do
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:passthrough => [
|
:device_specs => [
|
||||||
{
|
{
|
||||||
"vendor_id" => "8086",
|
"vendor_id" => "8086",
|
||||||
"product_id" => "0126"
|
"product_id" => "0126"
|
||||||
@@ -45,10 +45,10 @@ describe 'nova::compute::pci' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with passthrough JSON encoded string' do
|
context 'with device_specs JSON encoded string' do
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:passthrough => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"physical_network\":\"physnet1\"}]",
|
:device_specs => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"physical_network\":\"physnet1\"}]",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -59,10 +59,10 @@ describe 'nova::compute::pci' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when passthrough is empty' do
|
context 'when device_specs is empty' do
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:passthrough => []
|
:device_specs => []
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -71,10 +71,10 @@ describe 'nova::compute::pci' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when passthrough is empty string' do
|
context 'when device_specs is empty string' do
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:passthrough => ""
|
:device_specs => ""
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user