Merge "Add support for [DEFAULT] mkisofs_cmd"

This commit is contained in:
Zuul 2021-10-03 14:14:57 +00:00 committed by Gerrit Code Review
commit c5cf15fd74
4 changed files with 46 additions and 15 deletions

View File

@ -54,6 +54,10 @@
# (optional) Whether to force the config drive to be attached to all VMs
# Defaults to false
#
# [*mkisofs_cmd*]
# (optional) Name or path of the tool used for ISO image creation.
# Defaults to $::os_service_default
#
# [*virtio_nic*]
# (optional) Whether to use virtio for the nic driver of VMs
# Defaults to false
@ -317,6 +321,7 @@ class nova::compute (
$virtio_nic = false,
$instance_usage_audit = false,
$instance_usage_audit_period = 'month',
$mkisofs_cmd = $::os_service_default,
$use_cow_images = $::os_service_default,
$force_raw_images = $::os_service_default,
$virt_mkfs = $::os_service_default,
@ -481,6 +486,7 @@ Use the same parameter in nova::api class.')
nova_config {
'DEFAULT/use_cow_images': value => $use_cow_images;
'DEFAULT/mkisofs_cmd': value => $mkisofs_cmd;
'DEFAULT/force_raw_images': value => $force_raw_images;
'DEFAULT/virt_mkfs': value => $virt_mkfs;
'DEFAULT/reserved_host_memory_mb': value => $reserved_host_memory;
@ -577,11 +583,10 @@ Use the same parameter in nova::api class.')
}
if is_service_default($config_drive_format) or $config_drive_format == 'iso9660' {
ensure_packages($::nova::params::genisoimage_package_name, {
ensure_packages($::nova::params::mkisofs_package_name, {
tag => ['openstack', 'nova-support-package'],
})
}
nova_config {
'DEFAULT/config_drive_format': value => $config_drive_format;
}

View File

@ -28,7 +28,6 @@ class nova::params {
$serialproxy_package_name = 'openstack-nova-serialproxy'
$spicehtml5proxy_package_name = 'openstack-nova-console'
$ceph_client_package_name = 'ceph-common'
$genisoimage_package_name = 'genisoimage'
# service names
$api_service_name = 'openstack-nova-api'
$api_metadata_service_name = undef
@ -60,6 +59,11 @@ class nova::params {
$messagebus_service_name = 'dbus'
$nova_user = 'nova'
$nova_group = 'nova'
if $::operatingsystemmajrelease >= '9' {
$mkisofs_package_name = 'xorriso'
} else {
$mkisofs_package_name = 'genisoimage'
}
}
'Debian': {
# package names
@ -74,7 +78,7 @@ class nova::params {
$scheduler_package_name = 'nova-scheduler'
$tgt_package_name = 'tgt'
$ceph_client_package_name = 'ceph'
$genisoimage_package_name = 'genisoimage'
$mkisofs_package_name = 'genisoimage'
# service names
$api_service_name = 'nova-api'
$compute_service_name = 'nova-compute'

View File

@ -0,0 +1,6 @@
---
features:
- |
The new ``nova::compute::mkisofs_cmd`` parameter has been added to
change the mkisofs tools. This is going to assist with transition
from genisoimage to xorriso.

View File

@ -35,6 +35,7 @@ describe 'nova::compute' do
end
it { is_expected.to contain_nova_config('DEFAULT/use_cow_images').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/mkisofs_cmd').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/force_raw_images').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/virt_mkfs').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/reserved_host_memory_mb').with_value('<SERVICE DEFAULT>') }
@ -71,13 +72,13 @@ describe 'nova::compute' do
it { is_expected.to contain_class('nova::availability_zone') }
it 'installs genisoimage package and sets config_drive_format' do
it 'installs mkisofs package and sets config_drive_format' do
is_expected.to contain_nova_config('DEFAULT/config_drive_format').with_value('<SERVICE DEFAULT>')
is_expected.to contain_package('genisoimage').with(
is_expected.to contain_package(platform_params[:mkisofs_package]).with(
:ensure => 'installed',
)
is_expected.to contain_package('genisoimage').that_requires('Anchor[nova::install::begin]')
is_expected.to contain_package('genisoimage').that_comes_before('Anchor[nova::install::end]')
is_expected.to contain_package(platform_params[:mkisofs_package]).that_requires('Anchor[nova::install::begin]')
is_expected.to contain_package(platform_params[:mkisofs_package]).that_comes_before('Anchor[nova::install::end]')
end
it 'configures nova pci_passthrough_whitelist' do
@ -92,6 +93,7 @@ describe 'nova::compute' do
:ensure_package => '2012.1-2',
:vncproxy_host => '127.0.0.1',
:use_cow_images => false,
:mkisofs_cmd => 'mkisofs',
:force_raw_images => false,
:virt_mkfs => 'windows=mkfs.ntfs --force --fast %(target)s',
:reserved_host_memory => '0',
@ -164,6 +166,7 @@ describe 'nova::compute' do
end
it { is_expected.to contain_nova_config('DEFAULT/use_cow_images').with_value(false) }
it { is_expected.to contain_nova_config('DEFAULT/mkisofs_cmd').with_value('mkisofs') }
it { is_expected.to contain_nova_config('DEFAULT/force_raw_images').with_value(false) }
it { is_expected.to contain_nova_config('DEFAULT/virt_mkfs').with_value('windows=mkfs.ntfs --force --fast %(target)s') }
it { is_expected.to contain_nova_config('DEFAULT/reserved_host_memory_mb').with_value('0') }
@ -195,7 +198,7 @@ describe 'nova::compute' do
it 'configures nova config_drive_format to vfat' do
is_expected.to contain_nova_config('DEFAULT/config_drive_format').with_value('vfat')
is_expected.to_not contain_package('genisoimage').with(
is_expected.to_not contain_package(platform_params[:mkisofs_package]).with(
:ensure => 'present',
)
end
@ -451,16 +454,29 @@ describe 'nova::compute' do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
case facts[:osfamily]
when 'Debian'
let (:platform_params) do
{ :nova_compute_package => 'nova-compute',
:nova_compute_service => 'nova-compute' }
when 'RedHat'
:nova_compute_service => 'nova-compute',
:mkisofs_package => 'genisoimage' }
end
when 'RedHat'
let (:platform_params) do
{ :nova_compute_package => 'openstack-nova-compute',
:nova_compute_service => 'openstack-nova-compute' }
end
if facts[:operatingsystemmajrelease] > '8'
before do
platform_params.merge!({
:mkisofs_package => 'xorriso' })
end
else
before do
platform_params.merge!({
:mkisofs_package => 'genisoimage' })
end
end
end
it_behaves_like 'nova-compute'
end