Add options to enable Manila to run with NFS-Ganesha backend.

Change-Id: I44c3e49089fd8d5a1ee30ed84dc20944ba92461a
This commit is contained in:
Sachidananda Urs 2015-05-29 15:15:31 +05:30
parent 74df3c01a8
commit fe2430007a
3 changed files with 97 additions and 0 deletions

58
manifests/ganesha.pp Normal file
View File

@ -0,0 +1,58 @@
#
# == Class: manila::ganesha
#
# Class to set NFS Ganesha options for share drivers
#
# === Parameters
# [*ganesha_config_dir*]
# (required) Directory where Ganesha config files are stored.
# Defaults to /etc/ganesha
#
# [*ganesha_config_path*]
# (required) Path to main Ganesha config file.
# Defaults to $ganesha_config_dir/ganesha.conf
#
# [*ganesha_service_name*]
# (required) Name of the ganesha nfs service.
# Defaults to ganesha.nfsd
#
# [*ganesha_db_path*]
# (required) Location of Ganesha database file (Ganesha module only).
# Defaults to $state_path/manila-ganesha.db
#
# [*ganesha_export_dir*]
# (required) Path to directory containing Ganesha export configuration.
# (Ganesha module only.)
# Defaults to $ganesha_config_dir/export.d
#
# [*ganesha_export_template_dir*]
# (required) Path to directory containing Ganesha export block templates.
# (Ganesha module only.)
# Defaults to /etc/manila/ganesha-export-templ.d
#
class manila::ganesha (
$ganesha_config_dir = '/etc/ganesha',
$ganesha_config_path = '/etc/ganesha/ganesha.conf',
$ganesha_service_name = 'ganesha.nfsd',
$ganesha_db_path = '$state_path/manila-ganesha.db',
$ganesha_export_dir = '/etc/ganesha/export.d',
$ganesha_export_template_dir = '/etc/manila/ganesha-export-templ.d',
) {
manila_config {
'DEFAULT/ganesha_config_dir': value => $ganesha_config_dir;
'DEFAULT/ganesha_config_path': value => $ganesha_config_path;
'DEFAULT/ganesha_service_name': value => $ganesha_service_name;
'DEFAULT/ganesha_db_path': value => $ganesha_db_path;
'DEFAULT/ganesha_export_dir': value => $ganesha_export_dir;
'DEFAULT/ganesha_export_template_dir': value => $ganesha_export_template_dir;
}
if ($::osfamily == 'RedHat') {
package { 'nfs-ganesha':
ensure => present
}
} else {
warning("Unsupported osfamily ${::osfamily}, Red Hat is the only supported platform.")
}
}

View File

@ -99,6 +99,10 @@ describe 'basic manila' do
}
class { '::manila::scheduler': }
# NFS-Ganesha backend. Currently this feature is only for RHEL systems
# because Debian/Ubuntu systems do not have nfs-ganesha package yet.
class { '::manila::ganesha': }
# missing: backends, share, service_instance
EOS

View File

@ -0,0 +1,35 @@
require 'spec_helper'
describe 'manila::ganesha' do
shared_examples_for 'manila NFS Ganesha options for share drivers' do
let :params do
{
:ganesha_config_dir => '/etc/ganesha',
:ganesha_config_path => '/etc/ganesha/ganesha.conf',
:ganesha_service_name => 'ganesha.nfsd',
:ganesha_db_path => '$state_path/manila-ganesha.db',
:ganesha_export_dir => '/etc/ganesha/export.d',
:ganesha_export_template_dir => '/etc/manila/ganesha-export-templ.d',
}
end
it 'Adds NFS Ganesha options to the share drivers' do
params.each_pair do |config,value|
is_expected.to contain_manila_config("DEFAULT/#{config}").with_value(value)
end
end
it { is_expected.to contain_package('nfs-ganesha').with(
:name => 'nfs-ganesha',
:ensure => 'present',
) }
context 'on Red Hat platforms' do
let :facts do
{:osfamily => 'RedHat'}
end
it_configures 'manila NFS Ganesha options for share drivers'
end
end
end