Add pci/alias to compute manifest
Starting with Ocata pci_alias needs to be configured on compute nodes as well. This requires refactoring of the manifests as the parameter is common to nova::compute and nova::api. Common pci configuration is now done by the nova::pci class while compute specific configuration is done now by the nova::compute::pci class. Closes-Bug: #1702730 Change-Id: Iac4f22cbe043629ae9f0477ae62cf77ad0d761f8
This commit is contained in:
parent
f716f0e403
commit
c1a4ab211d
|
@ -74,13 +74,6 @@
|
|||
# (optional) Shared secret to validate proxies Neutron metadata requests
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*pci_alias*]
|
||||
# (optional) A list of pci alias hashes
|
||||
# Defaults to $::os_service_default
|
||||
# Example:
|
||||
# [{"vendor_id" => "1234", "product_id" => "5678", "name" => "default"},
|
||||
# {"vendor_id" => "1234", "product_id" => "6789", "name" => "other"}]
|
||||
#
|
||||
# [*ratelimits*]
|
||||
# (optional) A string that is a semicolon-separated list of 5-tuples.
|
||||
# See http://docs.openstack.org/trunk/config-reference/content/configuring-compute-API.html
|
||||
|
@ -275,6 +268,14 @@
|
|||
# (optional) Default pool for floating IPs
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*pci_alias*]
|
||||
# DEPRECATED. Use nova::pci::aliases instead.
|
||||
# (optional) A list of pci alias hashes
|
||||
# Defaults to undef
|
||||
# Example:
|
||||
# [{"vendor_id" => "1234", "product_id" => "5678", "name" => "default"},
|
||||
# {"vendor_id" => "1234", "product_id" => "6789", "name" => "other"}]
|
||||
#
|
||||
class nova::api(
|
||||
$enabled = true,
|
||||
$manage_service = true,
|
||||
|
@ -292,7 +293,6 @@ class nova::api(
|
|||
$sync_db_api = true,
|
||||
$db_online_data_migrations = false,
|
||||
$neutron_metadata_proxy_shared_secret = undef,
|
||||
$pci_alias = $::os_service_default,
|
||||
$ratelimits = undef,
|
||||
$ratelimits_factory =
|
||||
'nova.api.openstack.compute.limits:RateLimitingMiddleware.factory',
|
||||
|
@ -334,6 +334,7 @@ class nova::api(
|
|||
$osapi_glance_link_prefix = undef,
|
||||
$osapi_hide_server_address_states = undef,
|
||||
$default_floating_pool = undef,
|
||||
$pci_alias = undef,
|
||||
) inherits nova::params {
|
||||
|
||||
include ::nova::deps
|
||||
|
@ -536,14 +537,10 @@ as a standalone service, or httpd for being run by a httpd server")
|
|||
'filter:authtoken/auth_admin_prefix': ensure => absent;
|
||||
}
|
||||
|
||||
if !is_service_default($pci_alias) and !empty($pci_alias) {
|
||||
$pci_alias_real = to_array_of_json_strings($pci_alias)
|
||||
} else {
|
||||
$pci_alias_real = $::os_service_default
|
||||
}
|
||||
nova_config {
|
||||
'pci/alias': value => $pci_alias_real;
|
||||
if $pci_alias {
|
||||
warning('The pci_alias parameter is deprecated. Please use nova::pci::aliases instead.')
|
||||
}
|
||||
include ::nova::pci
|
||||
|
||||
if $validate {
|
||||
#Shrinking the variables names in favor of not
|
||||
|
|
|
@ -83,13 +83,6 @@
|
|||
# The amount of memory in MB reserved for the host.
|
||||
# Defaults to '512'
|
||||
#
|
||||
# [*pci_passthrough*]
|
||||
# (optional) Pci passthrough list of hash.
|
||||
# Defaults to $::os_service_default
|
||||
# Example of format:
|
||||
# [ { "vendor_id" => "1234","product_id" => "5678" },
|
||||
# { "vendor_id" => "4321","product_id" => "8765", "physical_network" => "default" } ]
|
||||
#
|
||||
# [*config_drive_format*]
|
||||
# (optional) Config drive format. One of iso9660 (default) or vfat
|
||||
# Defaults to undef
|
||||
|
@ -149,6 +142,16 @@
|
|||
# will disable itself.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# DEPRECATED
|
||||
#
|
||||
# [*pci_passthrough*]
|
||||
# DEPRECATED. Use nova::compute::pci::passthrough instead.
|
||||
# (optional) Pci passthrough list of hash.
|
||||
# Defaults to undef
|
||||
# Example of format:
|
||||
# [ { "vendor_id" => "1234","product_id" => "5678" },
|
||||
# { "vendor_id" => "4321","product_id" => "8765", "physical_network" => "default" } ]
|
||||
#
|
||||
class nova::compute (
|
||||
$enabled = true,
|
||||
$manage_service = true,
|
||||
|
@ -169,7 +172,6 @@ class nova::compute (
|
|||
$force_raw_images = true,
|
||||
$reserved_host_memory = '512',
|
||||
$heal_instance_info_cache_interval = '60',
|
||||
$pci_passthrough = $::os_service_default,
|
||||
$config_drive_format = $::os_service_default,
|
||||
$allow_resize_to_same_host = false,
|
||||
$resize_confirm_window = $::os_service_default,
|
||||
|
@ -181,6 +183,8 @@ class nova::compute (
|
|||
$barbican_api_version = $::os_service_default,
|
||||
$max_concurrent_live_migrations = $::os_service_default,
|
||||
$consecutive_build_service_disable_threshold = $::os_service_default,
|
||||
# DEPRECATED PARAMETERS
|
||||
$pci_passthrough = undef,
|
||||
) {
|
||||
|
||||
include ::nova::deps
|
||||
|
@ -188,14 +192,12 @@ class nova::compute (
|
|||
|
||||
$vcpu_pin_set_real = pick(join(any2array($vcpu_pin_set), ','), $::os_service_default)
|
||||
|
||||
# in the case of pci_passthrough, we can't use the same mechanism as vcpu_pin_set because
|
||||
# the value is computed in a function and it makes things more complex. Let's just check if
|
||||
# a value is set or if it's empty.
|
||||
if !is_service_default($pci_passthrough) and !empty($pci_passthrough) {
|
||||
$pci_passthrough_real = to_array_of_json_strings($pci_passthrough)
|
||||
} else {
|
||||
$pci_passthrough_real = $::os_service_default
|
||||
include ::nova::pci
|
||||
|
||||
if $pci_passthrough {
|
||||
warning('The pci_passthrough parameter is deprecated. Please use nova::compute::pci::passthrough instead.')
|
||||
}
|
||||
include ::nova::compute::pci
|
||||
|
||||
# cryptsetup is required when Barbican is encrypting volumes
|
||||
if $keymgr_api_class =~ /barbican/ {
|
||||
|
@ -210,7 +212,6 @@ class nova::compute (
|
|||
nova_config {
|
||||
'DEFAULT/reserved_host_memory_mb': value => $reserved_host_memory;
|
||||
'DEFAULT/heal_instance_info_cache_interval': value => $heal_instance_info_cache_interval;
|
||||
'pci/passthrough_whitelist': value => $pci_passthrough_real;
|
||||
'DEFAULT/resize_confirm_window': value => $resize_confirm_window;
|
||||
'DEFAULT/vcpu_pin_set': value => $vcpu_pin_set_real;
|
||||
'DEFAULT/resume_guests_state_on_host_boot': value => $resume_guests_state_on_host_boot;
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
# Class nova::compute::pci
|
||||
#
|
||||
# Configures nova compute pci options
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*passthrough*]
|
||||
# (optional) Pci passthrough list of hash.
|
||||
# Defaults to $::os_service_default
|
||||
# Example of format:
|
||||
# [ { "vendor_id" => "1234","product_id" => "5678" },
|
||||
# { "vendor_id" => "4321","product_id" => "8765", "physical_network" => "default" } ]
|
||||
|
||||
class nova::compute::pci(
|
||||
$passthrough = $::os_service_default
|
||||
) {
|
||||
include ::nova::deps
|
||||
|
||||
$picked_passthrough = pick_default($::nova::compute::pci_passthrough,$passthrough)
|
||||
|
||||
if $picked_passthrough and
|
||||
!is_service_default($picked_passthrough) and
|
||||
!empty($picked_passthrough) {
|
||||
$passthrough_real = to_array_of_json_strings($picked_passthrough)
|
||||
} else {
|
||||
$passthrough_real = $::os_service_default
|
||||
}
|
||||
nova_config {
|
||||
'pci/passthrough_whitelist': value => $passthrough_real;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
# Class nova::pci
|
||||
#
|
||||
# Configures nova pci options
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*aliases*]
|
||||
# (optional) A list of pci alias hashes
|
||||
# Defaults to $::os_service_default
|
||||
# Example:
|
||||
# [{"vendor_id" => "1234", "product_id" => "5678", "name" => "default"},
|
||||
# {"vendor_id" => "1234", "product_id" => "6789", "name" => "other"}]
|
||||
|
||||
class nova::pci(
|
||||
$aliases = $::os_service_default
|
||||
) {
|
||||
include ::nova::deps
|
||||
|
||||
$picked_aliases = pick_default($::nova::api::pci_alias, $aliases)
|
||||
|
||||
if $picked_aliases and
|
||||
!is_service_default($picked_aliases) and
|
||||
!empty($picked_aliases) {
|
||||
$aliases_real = to_array_of_json_strings($picked_aliases)
|
||||
} else {
|
||||
$aliases_real = $::os_service_default
|
||||
}
|
||||
nova_config {
|
||||
'pci/alias': value => $aliases_real;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
[pci]/alias option is now required in the nova configuration file on compute nodes too.
|
||||
This requires refactoring of the manifests as the parameter is common to nova::compute
|
||||
and nova::api.
|
||||
Common pci configuration is now done by the nova::pci class while compute specific
|
||||
configuration is done now by the nova::compute::pci class.
|
||||
deprecations:
|
||||
- |
|
||||
nova::api::pci_alias is deprecated by nova::pci::aliases
|
||||
nova::compute::pci_passthrough is deprecated by nova::compute::pci::passthrough
|
||||
|
|
@ -79,13 +79,17 @@ describe 'nova::api' do
|
|||
is_expected.to contain_nova_config('vendordata_dynamic_auth/project_name').with('value' => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_nova_config('vendordata_dynamic_auth/user_domain_name').with('value' => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_nova_config('vendordata_dynamic_auth/username').with('value' => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_nova_config('pci/alias').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
it 'unconfigures neutron_metadata proxy' do
|
||||
is_expected.to contain_nova_config('neutron/service_metadata_proxy').with(:value => false)
|
||||
is_expected.to contain_nova_config('neutron/metadata_proxy_shared_secret').with(:ensure => 'absent')
|
||||
end
|
||||
|
||||
it 'includes nova::pci' do
|
||||
is_expected.to contain_class('nova::pci')
|
||||
is_expected.to contain_nova_config('pci/alias').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with overridden parameters' do
|
||||
|
@ -201,6 +205,7 @@ describe 'nova::api' do
|
|||
})
|
||||
end
|
||||
it 'configures nova pci_alias entries' do
|
||||
is_expected.to contain_class('nova::pci')
|
||||
is_expected.to contain_nova_config('pci/alias').with(
|
||||
'value' => ['{"vendor_id":"8086","product_id":"0126","name":"graphic_card"}','{"vendor_id":"9096","product_id":"1520","name":"network_card"}']
|
||||
)
|
||||
|
@ -214,6 +219,7 @@ describe 'nova::api' do
|
|||
})
|
||||
end
|
||||
it 'configures nova pci_alias entries' do
|
||||
is_expected.to contain_class('nova::pci')
|
||||
is_expected.to contain_nova_config('pci/alias').with(
|
||||
'value' => ['{"vendor_id":"8086","product_id":"0126","name":"graphic_card"}','{"vendor_id":"9096","product_id":"1520","name":"network_card"}']
|
||||
)
|
||||
|
@ -221,11 +227,14 @@ describe 'nova::api' do
|
|||
end
|
||||
|
||||
context 'when pci_alias is empty' do
|
||||
let :params do
|
||||
{ :pci_alias => "" }
|
||||
before do
|
||||
params.merge!({
|
||||
:pci_alias => ""
|
||||
})
|
||||
end
|
||||
|
||||
it 'clears pci_alias configuration' do
|
||||
is_expected.to contain_class('nova::pci')
|
||||
is_expected.to contain_nova_config('pci/alias').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'nova::compute::pci' do
|
||||
|
||||
shared_examples_for 'nova-compute-pci' do
|
||||
context 'with default parameters' do
|
||||
it 'clears pci_passthrough_whitelist configuration' do
|
||||
is_expected.to contain_nova_config('pci/passthrough_whitelist').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with passthrough array' do
|
||||
let :params do
|
||||
{
|
||||
:passthrough => [
|
||||
{
|
||||
"vendor_id" => "8086",
|
||||
"product_id" => "0126"
|
||||
},
|
||||
{
|
||||
"vendor_id" => "9096",
|
||||
"product_id" => "1520",
|
||||
"physical_network" => "physnet1"
|
||||
}
|
||||
],
|
||||
}
|
||||
end
|
||||
it 'configures nova pci_passthrough_whitelist entries' do
|
||||
is_expected.to contain_nova_config('pci/passthrough_whitelist').with(
|
||||
'value' => ['{"vendor_id":"8086","product_id":"0126"}','{"vendor_id":"9096","product_id":"1520","physical_network":"physnet1"}']
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with passthrough JSON encoded string (deprecated)' do
|
||||
let :params do
|
||||
{
|
||||
:passthrough => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"physical_network\":\"physnet1\"}]",
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures nova pci_passthrough_whitelist entries' do
|
||||
is_expected.to contain_nova_config('pci/passthrough_whitelist').with(
|
||||
'value' => ['{"vendor_id":"8086","product_id":"0126"}','{"vendor_id":"9096","product_id":"1520","physical_network":"physnet1"}']
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when passthrough is empty' do
|
||||
let :params do
|
||||
{
|
||||
:passthrough => []
|
||||
}
|
||||
end
|
||||
|
||||
it 'clears pci_passthrough_whitelist configuration' do
|
||||
is_expected.to contain_nova_config('pci/passthrough_whitelist').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when passthrough is empty string' do
|
||||
let :params do
|
||||
{
|
||||
:passthrough => ""
|
||||
}
|
||||
end
|
||||
|
||||
it 'clears pci_passthrough_whitelist configuration' do
|
||||
is_expected.to contain_nova_config('pci/passthrough_whitelist').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'nova-compute-pci'
|
||||
end
|
||||
end
|
||||
end
|
|
@ -35,7 +35,6 @@ describe 'nova::compute' do
|
|||
it { is_expected.to contain_nova_config('barbican/auth_endpoint').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_nova_config('DEFAULT/max_concurrent_live_migrations').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_nova_config('compute/consecutive_build_service_disable_threshold').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_nova_config('pci/passthrough_whitelist').with(:value => '<SERVICE DEFAULT>') }
|
||||
|
||||
it { is_expected.to_not contain_package('cryptsetup').with( :ensure => 'present' )}
|
||||
|
||||
|
@ -61,6 +60,11 @@ describe 'nova::compute' do
|
|||
is_expected.to contain_package('genisoimage').that_requires('Anchor[nova::install::begin]')
|
||||
is_expected.to contain_package('genisoimage').that_comes_before('Anchor[nova::install::end]')
|
||||
end
|
||||
|
||||
it 'configures nova pci_passthrough_whitelist' do
|
||||
is_expected.to contain_class('nova::compute::pci')
|
||||
is_expected.to contain_nova_config('pci/passthrough_whitelist').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with overridden parameters' do
|
||||
|
@ -142,7 +146,7 @@ describe 'nova::compute' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with pci_passthrough array' do
|
||||
context 'with pci params array' do
|
||||
let :params do
|
||||
{
|
||||
:pci_passthrough => [
|
||||
|
@ -155,41 +159,44 @@ describe 'nova::compute' do
|
|||
"product_id" => "1520",
|
||||
"physical_network" => "physnet1"
|
||||
}
|
||||
]
|
||||
],
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures nova pci_passthrough_whitelist entries' do
|
||||
is_expected.to contain_class('nova::compute::pci')
|
||||
is_expected.to contain_nova_config('pci/passthrough_whitelist').with(
|
||||
'value' => ['{"vendor_id":"8086","product_id":"0126"}','{"vendor_id":"9096","product_id":"1520","physical_network":"physnet1"}']
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with pci_passthrough JSON encoded string (deprecated)' do
|
||||
context 'with pci params JSON encoded string (deprecated)' do
|
||||
let :params do
|
||||
{
|
||||
:pci_passthrough => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"physical_network\":\"physnet1\"}]"
|
||||
:pci_passthrough => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"physical_network\":\"physnet1\"}]",
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures nova pci_passthrough_whitelist entries' do
|
||||
is_expected.to contain_class('nova::compute::pci')
|
||||
is_expected.to contain_nova_config('pci/passthrough_whitelist').with(
|
||||
'value' => ['{"vendor_id":"8086","product_id":"0126"}','{"vendor_id":"9096","product_id":"1520","physical_network":"physnet1"}']
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when vcpu_pin_set and pci_passthrough are empty' do
|
||||
context 'when vcpu_pin_set and pci params are empty' do
|
||||
let :params do
|
||||
{ :vcpu_pin_set => "",
|
||||
:pci_passthrough => "" }
|
||||
:pci_passthrough => ""}
|
||||
end
|
||||
|
||||
it 'clears vcpu_pin_set configuration' do
|
||||
is_expected.to contain_nova_config('DEFAULT/vcpu_pin_set').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
it 'clears pci_passthrough configuration' do
|
||||
is_expected.to contain_class('nova::compute::pci')
|
||||
is_expected.to contain_nova_config('pci/passthrough_whitelist').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'nova::pci' do
|
||||
|
||||
shared_examples_for 'nova-pci' do
|
||||
context 'with default parameters' do
|
||||
it 'clears pci_alias configuration' do
|
||||
is_expected.to contain_nova_config('pci/alias').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with aliases array' do
|
||||
let :params do
|
||||
{
|
||||
:aliases => [{
|
||||
"vendor_id" => "8086",
|
||||
"product_id" => "0126",
|
||||
"name" => "graphic_card"
|
||||
},
|
||||
{
|
||||
"vendor_id" => "9096",
|
||||
"product_id" => "1520",
|
||||
"name" => "network_card"
|
||||
}
|
||||
]
|
||||
}
|
||||
end
|
||||
it 'configures nova pci_alias entries' do
|
||||
is_expected.to contain_nova_config('pci/alias').with(
|
||||
'value' => ['{"vendor_id":"8086","product_id":"0126","name":"graphic_card"}','{"vendor_id":"9096","product_id":"1520","name":"network_card"}']
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with aliases JSON encoded string (deprecated)' do
|
||||
let :params do
|
||||
{
|
||||
:aliases => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\",\"name\":\"graphic_card\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"name\":\"network_card\"}]",
|
||||
}
|
||||
end
|
||||
it 'configures nova pci_alias entries' do
|
||||
is_expected.to contain_nova_config('pci/alias').with(
|
||||
'value' => ['{"vendor_id":"8086","product_id":"0126","name":"graphic_card"}','{"vendor_id":"9096","product_id":"1520","name":"network_card"}']
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when aliases is empty' do
|
||||
let :params do
|
||||
{
|
||||
:aliases => []
|
||||
}
|
||||
end
|
||||
|
||||
it 'clears pci_alias configuration' do
|
||||
is_expected.to contain_nova_config('pci/alias').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when aliases is empty string' do
|
||||
let :params do
|
||||
{
|
||||
:aliases => ""
|
||||
}
|
||||
end
|
||||
|
||||
it 'clears pci_alias configuration' do
|
||||
is_expected.to contain_nova_config('pci/alias').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'nova-pci'
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue