lvm driver: Support lvm_type option

Change-Id: Iba6abb43a6e72f1cb5c44ff1fba5c1fcc95d3509
This commit is contained in:
Takashi Kajinami 2024-03-17 16:10:45 +09:00
parent 777dcf40c7
commit 08052b3852
5 changed files with 21 additions and 1 deletions

View File

@ -58,6 +58,10 @@
# (Optional) Protocol to use as iSCSI driver # (Optional) Protocol to use as iSCSI driver
# Defaults to $facts['os_service_default']. # Defaults to $facts['os_service_default'].
# #
# [*lvm_type*]
# (Optional) Type of LVM volumes to deploy
# Defaults to $facts['os_service_default'].
#
# [*manage_volume_type*] # [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type. # (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinder Volume type will be created # If set to true, a Cinder Volume type will be created
@ -84,6 +88,7 @@ define cinder::backend::iscsi (
$volumes_dir = '/var/lib/cinder/volumes', $volumes_dir = '/var/lib/cinder/volumes',
$target_helper = undef, $target_helper = undef,
$target_protocol = $facts['os_service_default'], $target_protocol = $facts['os_service_default'],
$lvm_type = $facts['os_service_default'],
Boolean $manage_volume_type = false, Boolean $manage_volume_type = false,
Hash $extra_options = {}, Hash $extra_options = {},
) { ) {
@ -119,6 +124,7 @@ define cinder::backend::iscsi (
"${name}/volume_group": value => $volume_group; "${name}/volume_group": value => $volume_group;
"${name}/volumes_dir": value => $volumes_dir; "${name}/volumes_dir": value => $volumes_dir;
"${name}/target_protocol": value => $target_protocol; "${name}/target_protocol": value => $target_protocol;
"${name}/lvm_type": value => $lvm_type;
} }
if $manage_volume_type { if $manage_volume_type {

View File

@ -79,6 +79,10 @@
# (Optional) Additional, list or comma separated string, ip addresses to map the NVMe-oF volume # (Optional) Additional, list or comma separated string, ip addresses to map the NVMe-oF volume
# Defaults to $facts['os_service_default'] # Defaults to $facts['os_service_default']
# #
# [*lvm_type*]
# (Optional) Type of LVM volumes to deploy
# Defaults to $facts['os_service_default'].
#
define cinder::backend::nvmeof ( define cinder::backend::nvmeof (
$target_ip_address, $target_ip_address,
$target_helper, $target_helper,
@ -99,6 +103,7 @@ define cinder::backend::nvmeof (
$nvmeof_conn_info_version = $facts['os_service_default'], $nvmeof_conn_info_version = $facts['os_service_default'],
$lvm_share_target = $facts['os_service_default'], $lvm_share_target = $facts['os_service_default'],
$target_secondary_ip_addresses = $facts['os_service_default'], $target_secondary_ip_addresses = $facts['os_service_default'],
$lvm_type = $facts['os_service_default'],
) { ) {
include cinder::deps include cinder::deps
@ -124,6 +129,7 @@ define cinder::backend::nvmeof (
"${name}/nvmeof_conn_info_version": value => $nvmeof_conn_info_version; "${name}/nvmeof_conn_info_version": value => $nvmeof_conn_info_version;
"${name}/lvm_share_target": value => $lvm_share_target; "${name}/lvm_share_target": value => $lvm_share_target;
"${name}/target_secondary_ip_addresses": value => join(any2array($target_secondary_ip_addresses), ','); "${name}/target_secondary_ip_addresses": value => join(any2array($target_secondary_ip_addresses), ',');
"${name}/lvm_type": value => $lvm_type;
} }
if $::cinder::params::nvmetcli_package_name { if $::cinder::params::nvmetcli_package_name {

View File

@ -0,0 +1,4 @@
---
features:
- |
The ``cinder::backend::iscsi::lvm_type`` parameter has been added.

View File

@ -19,6 +19,7 @@ describe 'cinder::backend::iscsi' do
is_expected.to contain_cinder_config('hippo/volume_group').with_value('<SERVICE DEFAULT>') is_expected.to contain_cinder_config('hippo/volume_group').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('hippo/volumes_dir').with_value('/var/lib/cinder/volumes') is_expected.to contain_cinder_config('hippo/volumes_dir').with_value('/var/lib/cinder/volumes')
is_expected.to contain_cinder_config('hippo/target_protocol').with_value('<SERVICE DEFAULT>') is_expected.to contain_cinder_config('hippo/target_protocol').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('hippo/lvm_type').with_value('<SERVICE DEFAULT>')
} }
end end
@ -34,7 +35,8 @@ describe 'cinder::backend::iscsi' do
:target_ip_address => '192.0.2.1', :target_ip_address => '192.0.2.1',
:volume_group => 'volumegroup', :volume_group => 'volumegroup',
:volumes_dir => '/etc/cinder/volumes', :volumes_dir => '/etc/cinder/volumes',
:target_protocol => 'iser' :target_protocol => 'iser',
:lvm_type => 'auto',
} }
end end
it { it {
@ -48,6 +50,7 @@ describe 'cinder::backend::iscsi' do
is_expected.to contain_cinder_config('hippo/volume_group').with_value('volumegroup') is_expected.to contain_cinder_config('hippo/volume_group').with_value('volumegroup')
is_expected.to contain_cinder_config('hippo/volumes_dir').with_value('/etc/cinder/volumes') is_expected.to contain_cinder_config('hippo/volumes_dir').with_value('/etc/cinder/volumes')
is_expected.to contain_cinder_config('hippo/target_protocol').with_value('iser') is_expected.to contain_cinder_config('hippo/target_protocol').with_value('iser')
is_expected.to contain_cinder_config('hippo/lvm_type').with_value('auto')
} }
end end

View File

@ -35,6 +35,7 @@ describe 'cinder::backend::nvmeof' do
is_expected.to contain_cinder_config('nvme-backend/nvmeof_conn_info_version').with_value('<SERVICE DEFAULT>') is_expected.to contain_cinder_config('nvme-backend/nvmeof_conn_info_version').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('nvme-backend/lvm_share_target').with_value('<SERVICE DEFAULT>') is_expected.to contain_cinder_config('nvme-backend/lvm_share_target').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('nvme-backend/target_secondary_ip_addresses').with_value('<SERVICE DEFAULT>') is_expected.to contain_cinder_config('nvme-backend/target_secondary_ip_addresses').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('nvme-backend/lvm_type').with_value('<SERVICE DEFAULT>')
} }
end end
end end