From 32fb6134c0e8c663959e474d3e41f318689b1597 Mon Sep 17 00:00:00 2001 From: Clayton O'Neill Date: Thu, 14 Jan 2016 12:56:42 +0000 Subject: [PATCH] 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 --- manifests/compute/libvirt.pp | 7 ++++++- spec/classes/nova_compute_libvirt_spec.rb | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/manifests/compute/libvirt.pp b/manifests/compute/libvirt.pp index 6f371b4d7..e008a39c3 100644 --- a/manifests/compute/libvirt.pp +++ b/manifests/compute/libvirt.pp @@ -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'], } } diff --git a/spec/classes/nova_compute_libvirt_spec.rb b/spec/classes/nova_compute_libvirt_spec.rb index d59ade760..1f8da9038 100644 --- a/spec/classes/nova_compute_libvirt_spec.rb +++ b/spec/classes/nova_compute_libvirt_spec.rb @@ -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')}