nvmeof backend: Add new parameters

This patch adds 3 new configuration parameters to
``cinder::backend::nvmeof``:

- ``nvmeof_conn_info_version``
- ``lvm_share_target``
- ``target_secondary_ip_addresses``

And it also defaults ``target_port`` to 4420, which is the correct port
for NVMe-oF.

Used-By: https://review.opendev.org/877546
Change-Id: If9ce568128d1effd4466aef81b2c8edc373c2c41
This commit is contained in:
Gorka Eguileor 2023-03-15 20:02:59 +01:00 committed by Takashi Kajinami
parent 2cde035bbc
commit d55f88c1de
3 changed files with 53 additions and 24 deletions

View File

@ -6,18 +6,19 @@
# [*target_ip_address*]
# (Required) The IP address of NVMe target.
#
# [*target_port*]
# (Required) Port that NVMe target is listening on.
#
# [*target_helper*]
# (Required) Target user-land tool to use.
#
# [*target_protocol*]
# (Required) Target protocol to use.
#
# [*target_port*]
# (Optional) Port that NVMe target is listening on.
# Defaults to 4420, the NVMe standard I/O port.
#
# [*target_prefix*]
# (Optional) Prefix for LVM volumes.
# Defaults to '$facts['os_service_default']'.
# Defaults to $facts['os_service_default'].
#
# [*nvmet_port_id*]
# (Optional) Port id of the NVMe target.
@ -45,35 +46,53 @@
# (Optional) Name for the VG that will contain exported volumes
# Defaults to $facts['os_service_default']
#
# [*nvmeof_conn_info_version*]
# (Optional) NVMe-oF Connection Information version
# Defaults to $facts['os_service_default']
#
# [*lvm_share_target*]
# (Optional) Use shared targets or per-volume targets
# Defaults to $facts['os_service_default']
#
# [*target_secondary_ip_addresses*]
# (Optional) Additional, list or comma separated string, ip addresses to map the NVMe-oF volume
# Defaults to $facts['os_service_default']
#
define cinder::backend::nvmeof (
$target_ip_address,
$target_port,
$target_helper,
$target_protocol,
$target_prefix = $facts['os_service_default'],
$nvmet_port_id = '1',
$nvmet_ns_id = '10',
$volume_backend_name = $name,
$backend_availability_zone = $facts['os_service_default'],
$volume_driver = 'cinder.volume.drivers.lvm.LVMVolumeDriver',
$volume_group = $facts['os_service_default'],
$target_port = '4420',
$target_prefix = $facts['os_service_default'],
$nvmet_port_id = '1',
$nvmet_ns_id = '10',
$volume_backend_name = $name,
$backend_availability_zone = $facts['os_service_default'],
$volume_driver = 'cinder.volume.drivers.lvm.LVMVolumeDriver',
$volume_group = $facts['os_service_default'],
$nvmeof_conn_info_version = $facts['os_service_default'],
$lvm_share_target = $facts['os_service_default'],
$target_secondary_ip_addresses = $facts['os_service_default'],
) {
include cinder::deps
include cinder::params
cinder_config {
"${name}/target_ip_address": value => $target_ip_address;
"${name}/target_port": value => $target_port;
"${name}/target_helper": value => $target_helper;
"${name}/target_protocol": value => $target_protocol;
"${name}/target_prefix": value => $target_prefix;
"${name}/nvmet_port_id": value => $nvmet_port_id;
"${name}/nvmet_ns_id": value => $nvmet_ns_id;
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/backend_availability_zone": value => $backend_availability_zone;
"${name}/volume_driver": value => $volume_driver;
"${name}/volume_group": value => $volume_group;
"${name}/target_ip_address": value => $target_ip_address;
"${name}/target_port": value => $target_port;
"${name}/target_helper": value => $target_helper;
"${name}/target_protocol": value => $target_protocol;
"${name}/target_prefix": value => $target_prefix;
"${name}/nvmet_port_id": value => $nvmet_port_id;
"${name}/nvmet_ns_id": value => $nvmet_ns_id;
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/backend_availability_zone": value => $backend_availability_zone;
"${name}/volume_driver": value => $volume_driver;
"${name}/volume_group": value => $volume_group;
"${name}/nvmeof_conn_info_version": value => $nvmeof_conn_info_version;
"${name}/lvm_share_target": value => $lvm_share_target;
"${name}/target_secondary_ip_addresses": value => join(any2array($target_secondary_ip_addresses), ',');
}
package { 'nvmetcli':

View File

@ -0,0 +1,8 @@
---
features:
- |
Add new parameters ``nvmeof_conn_info_version``, ``lvm_share_target``, and
``target_secondary_ip_addresses`` to ``cinder::backend::nvmeof``.
- |
Default ``cinder::backend::nvmeof::target_port`` to ``4420``, making it an
optional parameter now.

View File

@ -6,7 +6,6 @@ describe 'cinder::backend::nvmeof' do
let :req_params do
{
:target_ip_address => '127.0.0.2',
:target_port => '4420',
:target_helper => 'nvmet',
:target_protocol => 'nvmet_rdma',
}
@ -28,6 +27,9 @@ describe 'cinder::backend::nvmeof' do
is_expected.to contain_cinder_config('nvme-backend/volume_backend_name').with_value('nvme-backend')
is_expected.to contain_cinder_config('nvme-backend/backend_availability_zone').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('nvme-backend/volume_driver').with_value('cinder.volume.drivers.lvm.LVMVolumeDriver')
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/target_secondary_ip_addresses').with_value('<SERVICE DEFAULT>')
}
it { is_expected.to contain_package('nvmetcli').with(