Add ensure_package for nova libvirt package

Most other nova packages are already in classes that allow you to
specify the package ensure attribute for managing pinning, upgrading to
latest, or managing the packages externally.

Change-Id: Iee9004bd71f96ea1c3d8cc419e3b1cd4b9df6992
This commit is contained in:
Clayton O'Neill
2016-01-14 12:56:42 +00:00
parent fb7baa6b98
commit 32fb6134c0
2 changed files with 12 additions and 2 deletions

View File

@@ -5,6 +5,10 @@
#
# === Parameters:
#
# [*ensure_package*]
# (optional) The state of nova packages
# Defaults to 'present'
#
# [*libvirt_virt_type*]
# (optional) Libvirt domain type. Options are: kvm, lxc, qemu, uml, xen
# Defaults to 'kvm'
@@ -89,6 +93,7 @@
# Defaults to 'libvirt.LibvirtDriver'
#
class nova::compute::libvirt (
$ensure_package = 'present',
$libvirt_virt_type = 'kvm',
$vncserver_listen = '127.0.0.1',
$migration_support = false,
@@ -127,7 +132,7 @@ class nova::compute::libvirt (
if($::osfamily == 'Debian') {
package { "nova-compute-${libvirt_virt_type}":
ensure => present,
ensure => $ensure_package,
tag => ['openstack', 'nova-package'],
}
}

View File

@@ -56,7 +56,8 @@ describe 'nova::compute::libvirt' do
describe 'with params' do
let :params do
{ :libvirt_virt_type => 'qemu',
{ :ensure_package => 'latest',
:libvirt_virt_type => 'qemu',
:vncserver_listen => '0.0.0.0',
:libvirt_cpu_mode => 'host-passthrough',
:libvirt_cpu_model => 'kvm64',
@@ -70,6 +71,10 @@ describe 'nova::compute::libvirt' do
}
end
it { is_expected.to contain_package('nova-compute-qemu').with(
:name => 'nova-compute-qemu',
:ensure => 'latest'
) }
it { is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('libvirt.FoobarDriver')}
it { is_expected.to contain_nova_config('libvirt/virt_type').with_value('qemu')}
it { is_expected.to contain_nova_config('libvirt/cpu_mode').with_value('host-passthrough')}