Merge "Add images_type"

This commit is contained in:
Zuul 2021-03-29 22:02:04 +00:00 committed by Gerrit Code Review
commit 4a4d5a8772
5 changed files with 68 additions and 3 deletions

View File

@ -129,6 +129,11 @@
# (optional) Available capacity in MiB for file-backed memory.
# Defaults to $::os_service_default
#
# [*images_type*]
# (optional) VM Images format.
# Valid Values are raw, flat, qcow2, lvm, rbd, ploop, default
# Defaults to $::os_service_default
#
# [*volume_use_multipath*]
# (optional) Use multipath connection of the
# iSCSI or FC volume. Volumes can be connected in the
@ -321,6 +326,7 @@ class nova::compute::libvirt (
$rx_queue_size = $::os_service_default,
$tx_queue_size = $::os_service_default,
$file_backed_memory = undef,
$images_type = $::os_service_default,
$volume_use_multipath = $::os_service_default,
$nfs_mount_options = $::os_service_default,
$num_pcie_ports = $::os_service_default,
@ -564,6 +570,32 @@ in a future release. Use the enabled_perf_events parameter instead')
}
}
# TODO(tkajinam): Remove this implementation in X
if defined('$::nova::compute::rbd::ephemeral_storage') {
if $::nova::compute::rbd::ephemeral_storage {
# When nova::compute::rbd is evaluated before nova::compute::libvirt, we
# need to fail setting images_type because it would have been handled in
# nova::compute::rbd
if is_service_default($images_type) {
warning('nova::compute::libvirt::images_type will be required if rbd ephemeral storage is used.')
} elsif $images_type != 'rbd' {
fail('nova::compute::libvirt::images_type should be rbd if rbd ephemeral storage is used.')
}
} else {
nova_config {
'libvirt/images_type': value => $images_type;
}
}
} else {
# This is when only nova::compute::libvirt is used,
# or when nova::compute::libvirt is evaluated before nova::compute::rbd
if !is_service_default($images_type) {
nova_config {
'libvirt/images_type': value => $images_type;
}
}
}
nova_config {
'DEFAULT/compute_driver': value => $compute_driver;
'DEFAULT/preallocate_images': value => $preallocate_images;

View File

@ -125,8 +125,31 @@ class nova::compute::rbd (
}
if $ephemeral_storage {
# TODO(tkajinam): Remove this implementation in X
if defined('$::nova::compute::libvirt::images_type') {
# When nova::compute::libvirt is evaluated before nova::compute::rbd, we
# never set it here unless $::nova::compute::libvirt::images_type is
# default, for backwards compatibility
$images_type_real = $::nova::compute::libvirt::images_type
if is_service_default($images_type_real) {
warning('nova::compute::libvirt::images_type will be required if rbd ephemeral storage is used.')
nova_config {
'libvirt/images_type': value => 'rbd';
}
} elsif $images_type_real != 'rbd' {
fail('nova::compute::libvirt::images_type should be rbd if rbd ephemeral storage is used.')
}
}
else {
# This is when only nova::compute::rbd is used,
# or when nova::compute::rbd is evaluated before nova::compute::libvirt
nova_config {
'libvirt/images_type': value => 'rbd';
}
}
nova_config {
'libvirt/images_type': value => 'rbd';
'libvirt/images_rbd_pool': value => $libvirt_images_rbd_pool;
'libvirt/images_rbd_ceph_conf': value => $libvirt_images_rbd_ceph_conf;
}

View File

@ -0,0 +1,10 @@
---
features:
- Add new parameter "nova::compute::libvirt::images_type", VM Images format.
If default is specified, then use_cow_images flag is used instead of this
one.
deprecations:
- The "images_type" parameter will be required if rbd ephemeral storage is
used in a future release. Ensure the parameter is set to 'rbd' if
the deployment use rbd as its ephemeral storage backend.

View File

@ -97,6 +97,7 @@ describe 'nova::compute::libvirt' do
:preallocate_images => 'space',
:rx_queue_size => 512,
:tx_queue_size => 1024,
:images_type => 'raw',
:volume_use_multipath => false,
:nfs_mount_options => 'rw,intr,nolock',
:num_pcie_ports => 16,
@ -133,6 +134,7 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('vnc/server_listen').with_value('0.0.0.0')}
it { is_expected.to contain_nova_config('libvirt/rx_queue_size').with_value(512)}
it { is_expected.to contain_nova_config('libvirt/tx_queue_size').with_value(1024)}
it { is_expected.to contain_nova_config('libvirt/images_type').with_value('raw')}
it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value(false)}
it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('rw,intr,nolock')}
it { is_expected.to contain_nova_config('libvirt/num_pcie_ports').with_value(16)}

View File

@ -35,7 +35,6 @@ describe 'nova::compute::rbd' do
it { is_expected.to contain_class('nova::params') }
it 'configure nova.conf with default parameters' do
is_expected.to contain_nova_config('libvirt/images_type').with_value('rbd')
is_expected.to contain_nova_config('libvirt/images_rbd_pool').with_value('rbd')
is_expected.to contain_nova_config('libvirt/images_rbd_ceph_conf').with_value('/etc/ceph/ceph.conf')
is_expected.to contain_nova_config('libvirt/rbd_user').with_value('nova')
@ -59,7 +58,6 @@ describe 'nova::compute::rbd' do
end
it 'configure nova.conf with overridden parameters' do
is_expected.to contain_nova_config('libvirt/images_type').with_value('rbd')
is_expected.to contain_nova_config('libvirt/images_rbd_pool').with_value('AnotherPool')
is_expected.to contain_nova_config('libvirt/images_rbd_ceph_conf').with_value('/tmp/ceph.conf')
is_expected.to contain_nova_config('libvirt/rbd_user').with_value('joe')