Add NVMeOF backend
Change-Id: I8f8477a250e9335db690b94f29ea92d0cadbb49a
This commit is contained in:
parent
e7142cd57b
commit
3631e9c27f
71
manifests/backend/nvmeof.pp
Normal file
71
manifests/backend/nvmeof.pp
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
#
|
||||||
|
# Define: cinder::backend::nvmeof
|
||||||
|
#
|
||||||
|
# === Parameters:
|
||||||
|
#
|
||||||
|
# [*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 rotocol to use.
|
||||||
|
#
|
||||||
|
# [*target_prefix*]
|
||||||
|
# (Optional) Prefix for LVM volumes.
|
||||||
|
# Defaults to '$::cinder::params::target_prefix'.
|
||||||
|
#
|
||||||
|
# [*nvmet_port_id*]
|
||||||
|
# (Optional) Port id of the NVMe target.
|
||||||
|
# Defaults to '$::cinder::params::nvmet_port_id'.
|
||||||
|
#
|
||||||
|
# [*nvmet_ns_id*]
|
||||||
|
# (Optional) The namespace id associated with the subsystem.
|
||||||
|
# Defaults to '$::cinder::params::nvmet_ns_id'.
|
||||||
|
#
|
||||||
|
# [*volume_backend_name*]
|
||||||
|
# (optional) Allows for the volume_backend_name to be separate of $name.
|
||||||
|
# Defaults to: $name
|
||||||
|
#
|
||||||
|
# [*volume_driver*]
|
||||||
|
# (Optional) Driver to use for volume creation
|
||||||
|
# Defaults to 'cinder.volume.drivers.lvm.LVMVolumeDriver'.
|
||||||
|
#
|
||||||
|
# [*volume_group*]
|
||||||
|
# (Optional) Name for the VG that will contain exported volumes
|
||||||
|
# Defaults to $::os_service_default
|
||||||
|
#
|
||||||
|
define cinder::backend::nvmeof (
|
||||||
|
$target_ip_address,
|
||||||
|
$target_port,
|
||||||
|
$target_helper,
|
||||||
|
$target_protocol,
|
||||||
|
$target_prefix = $::os_service_default,
|
||||||
|
$nvmet_port_id = '1',
|
||||||
|
$nvmet_ns_id = '10',
|
||||||
|
$volume_backend_name = $name,
|
||||||
|
$volume_driver = 'cinder.volume.drivers.lvm.LVMVolumeDriver',
|
||||||
|
$volume_group = $::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}/volume_driver": value => $volume_driver;
|
||||||
|
"${name}/volume_group": value => $volume_group;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
45
spec/defines/cinder_backend_nvmeof_spec.rb
Normal file
45
spec/defines/cinder_backend_nvmeof_spec.rb
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'cinder::backend::nvmeof' do
|
||||||
|
|
||||||
|
let(:title) {'nvme-backend'}
|
||||||
|
|
||||||
|
let :req_params do {
|
||||||
|
:target_ip_address => '127.0.0.2',
|
||||||
|
:target_port => '4420',
|
||||||
|
:target_helper => 'nvmet',
|
||||||
|
:target_protocol => 'nvmet_rdma',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
let :facts do
|
||||||
|
OSDefaults.get_facts({:osfamily => 'Debian'})
|
||||||
|
end
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
req_params
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'with default params' do
|
||||||
|
|
||||||
|
it 'should configure nvmet target' do
|
||||||
|
is_expected.to contain_cinder_config('nvme-backend/target_ip_address').with(
|
||||||
|
:value => '127.0.0.2')
|
||||||
|
is_expected.to contain_cinder_config('nvme-backend/target_port').with(
|
||||||
|
:value => '4420')
|
||||||
|
is_expected.to contain_cinder_config('nvme-backend/target_helper').with(
|
||||||
|
:value => 'nvmet')
|
||||||
|
is_expected.to contain_cinder_config('nvme-backend/target_protocol').with(
|
||||||
|
:value => 'nvmet_rdma')
|
||||||
|
is_expected.to contain_cinder_config('nvme-backend/nvmet_port_id').with(
|
||||||
|
:value => '1')
|
||||||
|
is_expected.to contain_cinder_config('nvme-backend/nvmet_ns_id').with(
|
||||||
|
:value => '10')
|
||||||
|
is_expected.to contain_cinder_config('nvme-backend/volume_backend_name').with(
|
||||||
|
:value => 'nvme-backend')
|
||||||
|
is_expected.to contain_cinder_config('nvme-backend/volume_driver').with(
|
||||||
|
:value => 'cinder.volume.drivers.lvm.LVMVolumeDriver')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user