From 7b52544e614861dea15bdae53e6e27498bcbc0d7 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Tue, 10 Nov 2015 21:50:35 -0600 Subject: [PATCH] Use os_package_type for libvirt service name This change updates the puppet-nova module to use the correct libvirt service name and log group for the debian packages. In addition the tests have been updated to properly test the debian and ubuntu packages. Change-Id: I8fcca7c1d14f5dec3840789ef00c9ccd11c6191b Closes-Bug: #1515076 --- manifests/params.pp | 6 +-- spec/classes/nova_compute_libvirt_spec.rb | 63 ++++++++++++++++++----- 2 files changed, 52 insertions(+), 17 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index abbc8ec14..6c9628cd0 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -89,13 +89,13 @@ class nova::params { $compute_service_name = 'nova-compute' $conductor_service_name = 'nova-conductor' $consoleauth_service_name = 'nova-consoleauth' - $libvirt_service_name = 'libvirt-bin' $network_service_name = 'nova-network' $objectstore_service_name = 'nova-objectstore' $scheduler_service_name = 'nova-scheduler' $vncproxy_service_name = 'nova-novncproxy' $serialproxy_service_name = 'nova-serialproxy' $tgt_service_name = 'tgt' + $nova_log_group = 'adm' # debian specific nova config $root_helper = 'sudo nova-rootwrap' $lock_path = '/var/lock/nova' @@ -106,7 +106,7 @@ class nova::params { $vncproxy_package_name = 'nova-consoleproxy' # Use default provider on Debian $special_service_provider = undef - $nova_log_group = 'nova' + $libvirt_service_name = 'libvirtd' } default: { $spicehtml5proxy_package_name = 'nova-spiceproxy' @@ -114,7 +114,7 @@ class nova::params { $vncproxy_package_name = 'nova-novncproxy' # some of the services need to be started form the special upstart provider $special_service_provider = 'upstart' - $nova_log_group = 'adm' + $libvirt_service_name = 'libvirt-bin' } } } diff --git a/spec/classes/nova_compute_libvirt_spec.rb b/spec/classes/nova_compute_libvirt_spec.rb index 0f404bf4f..1e1116436 100644 --- a/spec/classes/nova_compute_libvirt_spec.rb +++ b/spec/classes/nova_compute_libvirt_spec.rb @@ -5,11 +5,7 @@ describe 'nova::compute::libvirt' do "include nova\ninclude nova::compute" end - describe 'on debian platforms' do - let :facts do - { :osfamily => 'Debian' } - end - + shared_examples 'debian-nova-compute-libvirt' do describe 'with default parameters' do it { is_expected.to contain_class('nova::params')} @@ -149,11 +145,11 @@ describe 'nova::compute::libvirt' do end - describe 'on rhel platforms' do - let :facts do - { :operatingsystem => 'RedHat', :osfamily => 'RedHat', + shared_examples 'redhat-nova-compute-libvirt' do + before do + facts.merge!({ :operatingsystem => 'RedHat', :osfamily => 'RedHat', :operatingsystemrelease => 6.5, - :operatingsystemmajrelease => '6' } + :operatingsystemmajrelease => '6' }) end describe 'with default parameters' do @@ -188,9 +184,11 @@ describe 'nova::compute::libvirt' do ) } describe 'on rhel 7' do - let :facts do - super().merge(:operatingsystemrelease => 7.0) - super().merge(:operatingsystemmajrelease => '7') + before do + facts.merge!({ + :operatingsystemrelease => 7.0, + :operatingsystemmajrelease => '7' + }) end it { is_expected.to contain_service('libvirt').with( @@ -282,8 +280,8 @@ describe 'nova::compute::libvirt' do end describe 'with default parameters on Fedora' do - let :facts do - { :operatingsystem => 'Fedora', :osfamily => 'RedHat' } + before do + facts.merge!({ :operatingsystem => 'Fedora', :osfamily => 'RedHat' }) end it { is_expected.to contain_class('nova::params')} @@ -314,4 +312,41 @@ describe 'nova::compute::libvirt' do end end + + context 'on Debian platforms' do + let (:facts) do + { + :osfamily => 'Debian', + :operatingsystem => 'Debian', + :os_package_family => 'debian' + } + end + + it_behaves_like 'debian-nova-compute-libvirt' + end + + context 'on Debian platforms' do + let (:facts) do + { + :osfamily => 'Debian', + :operatingsystem => 'Ubuntu', + :os_package_family => 'ubuntu' + } + end + + it_behaves_like 'debian-nova-compute-libvirt' + end + + context 'on RedHat platforms' do + let (:facts) do + { + :osfamily => 'RedHat', + :os_package_type => 'rpm' + } + end + + it_behaves_like 'redhat-nova-compute-libvirt' + end + + end