mdev: Simplify handling of device_addresses
The device_addresses option defaults to an empty list ([]), so we don't have to replace an empty string value by the os_service_default fact. Change-Id: I244e80ff8a5d393fb94e8a4e635401eb88936b39
This commit is contained in:
parent
f483df8d99
commit
1fbdef7ac6
@ -29,18 +29,9 @@ define nova::compute::mdev_type (
|
||||
$max_instances = $facts['os_service_default'],
|
||||
) {
|
||||
|
||||
if empty($device_addresses) {
|
||||
nova_config {
|
||||
"mdev_${mdev_type}/device_addresses": value => $facts['os_service_default']
|
||||
}
|
||||
} else {
|
||||
nova_config {
|
||||
"mdev_${mdev_type}/device_addresses": value => join(any2array($device_addresses), ',');
|
||||
}
|
||||
}
|
||||
|
||||
nova_config {
|
||||
"mdev_${mdev_type}/mdev_class": value => $mdev_class;
|
||||
"mdev_${mdev_type}/max_instances": value => $max_instances;
|
||||
"mdev_${mdev_type}/device_addresses": value => join(any2array($device_addresses), ',');
|
||||
"mdev_${mdev_type}/mdev_class": value => $mdev_class;
|
||||
"mdev_${mdev_type}/max_instances": value => $max_instances;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ describe 'nova::compute::mdev' do
|
||||
is_expected.to contain_nova_config('mdev_nvidia-35/device_addresses').with_value('0000:84:00.0,0000:85:00.0')
|
||||
is_expected.to contain_nova_config('mdev_nvidia-35/mdev_class').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_nova_config('mdev_nvidia-35/max_instances').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_nova_config('mdev_nvidia-36/device_addresses').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_nova_config('mdev_nvidia-36/device_addresses').with_value('')
|
||||
is_expected.to contain_nova_config('mdev_nvidia-36/mdev_class').with_value('CUSTOM_MDEV1')
|
||||
is_expected.to contain_nova_config('mdev_nvidia-36/max_instances').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_nova_config('mdev_nvidia-37/device_addresses').with_value('<SERVICE DEFAULT>')
|
||||
|
Loading…
Reference in New Issue
Block a user