Handle config_drive_format option

In order to mount a config drive as CD-ROM the 'genisoimage'
package should be explicitly installed on Compute nodes.

Change-Id: I197261300ee8c02101b0f3ed9b92bac1006d4ebe
This commit is contained in:
Michael Polenchuk
2016-03-21 14:36:54 +03:00
parent acfd93465a
commit 07a736742c
3 changed files with 24 additions and 5 deletions

View File

@@ -150,7 +150,7 @@ class nova::compute (
$compute_manager = 'nova.compute.manager.ComputeManager',
$heal_instance_info_cache_interval = '60',
$pci_passthrough = undef,
$config_drive_format = undef,
$config_drive_format = $::os_service_default,
$allow_resize_to_same_host = false,
$vcpu_pin_set = $::os_service_default,
# DEPRECATED PARAMETERS
@@ -262,9 +262,14 @@ class nova::compute (
}
}
if ($config_drive_format) {
nova_config {
'DEFAULT/config_drive_format': value => $config_drive_format;
}
if is_service_default($config_drive_format) or $config_drive_format == 'iso9660' {
ensure_packages($::nova::params::genisoimage_package_name, {
tag => ['openstack', 'nova-support-package'],
})
}
nova_config {
'DEFAULT/config_drive_format': value => $config_drive_format;
}
}

View File

@@ -29,6 +29,7 @@ class nova::params {
$sqlite_package_name = undef
$pymysql_package_name = undef
$ceph_client_package_name = 'ceph-common'
$genisoimage_package_name = 'genisoimage'
# service names
$api_service_name = 'openstack-nova-api'
$cells_service_name = 'openstack-nova-cells'
@@ -88,6 +89,7 @@ class nova::params {
$sqlite_package_name = 'python-pysqlite2'
$pymysql_package_name = 'python-pymysql'
$ceph_client_package_name = 'ceph'
$genisoimage_package_name = 'genisoimage'
# service names
$api_service_name = 'nova-api'
$cells_service_name = 'nova-cells'

View File

@@ -43,6 +43,15 @@ describe 'nova::compute' do
end
it { is_expected.to contain_nova_config('DEFAULT/heal_instance_info_cache_interval').with_value('60') }
it 'installs genisoimage 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(
:ensure => 'present',
)
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]')
end
end
context 'with overridden parameters' do
@@ -116,6 +125,9 @@ describe 'nova::compute' do
end
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(
:ensure => 'present',
)
end
end