Merge "Add LVM backend"

This commit is contained in:
Zuul 2021-04-12 18:14:07 +00:00 committed by Gerrit Code Review
commit 719681e528
3 changed files with 108 additions and 0 deletions

61
manifests/backend/lvm.pp Normal file
View File

@ -0,0 +1,61 @@
#
# == Defines: manila::backend::lvm
#
# Configures Manila to use LVM as a share driver
#
# === Parameters
# [*lvm_share_export_ip*]
# (required) List of IPs to export shares belonging to the LVM storage driver.
#
# [*share_backend_name*]
# (optional) Name of the backend in manila.conf that these settings will
# reside in.
# Defaults to: $name
#
# [*driver_handles_share_servers*]
# (optional) Denotes whether the driver should handle the responsibility of
# managing share servers. This must be set to false if the driver is to
# operate without managing share servers.
# Defaults to: $::os_service_default
#
# [*lvm_share_export_root*]
# (optional) Base folder where exported shares are located.
# Defauls to: $::os_service_default
#
# [*lvm_share_mirrors*]
# (optional) If set, create LVMs with multiple mirrors. Note that this requires
# lvm_mirrors + 2 PVs with available space.
# Defaults to: $::os_service_default
# [*lvm_share_volume_group*]
# (optional) Name for the VG that will contain exported shares. (string value)
# Defaults to: $::os_service_default
# [*lvm_share_helpers*]
# (optional) Specify list of share export helpers. (list value)
# Defaults to: $::os_service_default
#
define manila::backend::lvm (
$lvm_share_export_ip,
$share_backend_name = $name,
$driver_handles_share_servers = $::os_service_default,
$lvm_share_export_root = $::os_service_default,
$lvm_share_mirrors = $::os_service_default,
$lvm_share_volume_group = $::os_service_default,
$lvm_share_helpers = $::os_service_default,
) {
include manila::deps
$share_driver = 'manila.share.drivers.lvm.LVMShareDriver'
manila_config {
"${name}/share_backend_name": value => $share_backend_name;
"${name}/share_driver": value => $share_driver;
"${name}/driver_handles_share_servers": value => $driver_handles_share_servers;
"${name}/lvm_share_export_ip": value => $lvm_share_export_ip;
"${name}/lvm_share_export_root": value => $lvm_share_export_root;
"${name}/lvm_share_mirrors": value => $lvm_share_mirrors;
"${name}/lvm_share_volume_group": value => $lvm_share_volume_group;
"${name}/lvm_share_helpers": value => join(any2array($lvm_share_helpers), ',');
}
}

View File

@ -0,0 +1,3 @@
---
features:
- Allow to configure Manila with LVM backend.

View File

@ -0,0 +1,44 @@
require 'spec_helper'
describe 'manila::backend::lvm' do
shared_examples_for 'lvm share driver' do
let(:title) {'mylvm'}
let :params do
{
:driver_handles_share_servers => false,
:lvm_share_export_ip => '1.2.3.4',
:lvm_share_export_root => '$state_path/mnt',
:lvm_share_mirrors => 1,
:lvm_share_volume_group => 'lvm-shares',
:lvm_share_helpers => ['CIFS=manila.share.drivers.helpers.CIFSHelperUserAccess','NFS=manila.share.drivers.helpers.NFSHelper'],
}
end
it 'configures lvm share driver' do
is_expected.to contain_manila_config('mylvm/share_backend_name').with_value('mylvm')
is_expected.to contain_manila_config('mylvm/share_driver').with_value(
'manila.share.drivers.lvm.LVMShareDriver')
is_expected.to contain_manila_config('mylvm/driver_handles_share_servers').with_value(false)
is_expected.to contain_manila_config('mylvm/lvm_share_export_ip').with_value('1.2.3.4')
is_expected.to contain_manila_config('mylvm/lvm_share_export_root').with_value('$state_path/mnt')
is_expected.to contain_manila_config('mylvm/lvm_share_mirrors').with_value('1')
is_expected.to contain_manila_config('mylvm/lvm_share_volume_group').with_value('lvm-shares')
is_expected.to contain_manila_config('mylvm/lvm_share_helpers').with_value(
'CIFS=manila.share.drivers.helpers.CIFSHelperUserAccess,NFS=manila.share.drivers.helpers.NFSHelper')
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'lvm share driver'
end
end
end