Cleanup device addresses of vgpu type when empty

This change makes sure that device_addresses parameter is unset when
empty list of device addresses is associated with a vgpu type, so that
unmanaged parameter is not left.

Change-Id: Id6a354401b3233d3a17081d97a1a0e25f24d3219
This commit is contained in:
Takashi Kajinami 2020-09-17 23:38:17 +09:00
parent fbf77c0776
commit 851dc512e1
2 changed files with 5 additions and 0 deletions

View File

@ -43,6 +43,10 @@ class nova::compute::vgpu(
nova_config {
"vgpu_${vgpu_type}/device_addresses": value => join(any2array($device_addresses), ',');
}
} else {
nova_config {
"vgpu_${vgpu_type}/device_addresses": ensure => absent;
}
}
}
} else {

View File

@ -29,6 +29,7 @@ describe 'nova::compute::vgpu' do
}
end
it { is_expected.to contain_nova_config('devices/enabled_vgpu_types').with_value('nvidia-35') }
it { is_expected.to contain_nova_config('vgpu_nvidia-35/device_addresses').with_ensure('absent') }
end
context 'with multiple vgpu devices' do