Add CephFSNative driver logic

Adds the manifest for CephFSNative driver.

Change-Id: Ie97b1eb5fbb96417310fbfeb83bca67a96a01881
This commit is contained in:
Erno Kuvaja 2016-08-11 10:16:51 +01:00
parent a33e4337be
commit 2a13d46a43
5 changed files with 110 additions and 1 deletions

View File

@ -47,6 +47,10 @@
# HTTPProxyToWSGI middleware.
# Defaults to $::os_service_default.
#
# [*enabled_share_protocols*]
# (optional) Defines the enabled share protocols provided by Manila.
# Defaults to $::os_service_default
#
# === DEPRECATED PARAMTERS
#
# [*keystone_enabled*]
@ -104,6 +108,7 @@ class manila::api (
$ratelimits = undef,
$ratelimits_factory = 'manila.api.v1.limits:RateLimitingMiddleware.factory',
$enable_proxy_headers_parsing = $::os_service_default,
$enabled_share_protocols = $::os_service_default,
# Deprecated
$keystone_enabled = undef,
$keystone_user = undef,
@ -196,7 +201,8 @@ class manila::api (
}
manila_config {
'DEFAULT/osapi_share_listen': value => $bind_host,
'DEFAULT/osapi_share_listen': value => $bind_host;
'DEFAULT/enabled_share_protocols': value => $enabled_share_protocols;
}
oslo::middleware { 'manila_config':

View File

@ -0,0 +1,52 @@
# ==define manila::backend::cephfsnative
#
# === Parameters
#
# [*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: False
#
# [*share_backend_name*]
# (optional) Name of the backend in manila.conf that
# these settings will reside in
# Defaults to: cephfsnative
#
# [*cephfs_conf_path*]
# (optional) Path to cephfs config.
# Defaults to: $state_path/ceph.conf
#
# [*cephfs_auth_id*]
# (optional) cephx user id for Manila
# Defaults to: manila
#
# [*cephfs_cluster_name*]
# (optional) Name of the cephfs cluster the driver will connect to.
# Defaults to: ceph
#
# [*cephfs_enable_snapshots*]
# (optional) If set to True, then Manila will utilize ceph snapshots.
# Defaults to: True
#
define manila::backend::cephfsnative (
$driver_handles_share_servers = false,
$share_backend_name = $name,
$cephfs_conf_path = '$state_path/ceph.conf',
$cephfs_auth_id = 'manila',
$cephfs_cluster_name = 'ceph',
$cephfs_enable_snapshots = true,
) {
$share_driver = 'manila.share.drivers.cephfs.cephfs_native.CephFSNativeDriver'
manila_config {
"${name}/driver_handles_share_servers": value => $driver_handles_share_servers;
"${name}/share_backend_name": value => $share_backend_name;
"${name}/share_driver": value => $share_driver;
"${name}/cephfs_conf_path": value => $cephfs_conf_path;
"${name}/cephfs_auth_id": value => $cephfs_auth_id;
"${name}/cephfs_cluster_name": value => $cephfs_cluster_name;
"${name}/cephfs_enable_snapshots": value => $cephfs_enable_snapshots;
}
}

View File

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

View File

@ -23,6 +23,7 @@ describe 'manila::api' do
it 'should configure manila api correctly' do
is_expected.to contain_manila_config('DEFAULT/auth_strategy').with(:value => 'keystone')
is_expected.to contain_manila_config('DEFAULT/osapi_share_listen').with(:value => '0.0.0.0')
is_expected.to contain_manila_config('DEFAULT/enabled_share_protocols').with(:value => '<SERVICE DEFAULT>')
is_expected.to_not contain_manila_config('DEFAULT/os_region_name')
is_expected.to contain_manila_config('oslo_middleware/enable_proxy_headers_parsing').with_value('<SERVICE DEFAULT>')
end

View File

@ -0,0 +1,47 @@
require 'spec_helper'
describe 'manila::backend::cephfsnative' do
shared_examples_for 'cephfsnative driver' do
let(:title) {'cephfsnative'}
let :params do
{
:driver_handles_share_servers => false,
:share_backend_name => 'cephfs',
:cephfs_conf_path => '$state_path/ceph.conf',
:cephfs_auth_id => 'manila',
:cephfs_cluster_name => 'ceph',
:cephfs_enable_snapshots => true,
}
end
it 'configures cephfsnative driver' do
is_expected.to contain_manila_config('cephfsnative/share_driver').with_value(
'manila.share.drivers.cephfs.cephfs_native.CephFSNativeDriver')
is_expected.to contain_manila_config('cephfsnative/share_backend_name').with_value(
'cephfs')
is_expected.to contain_manila_config('cephfsnative/cephfs_conf_path').with_value(
'$state_path/ceph.conf')
is_expected.to contain_manila_config('cephfsnative/cephfs_auth_id').with_value(
'manila')
is_expected.to contain_manila_config('cephfsnative/cephfs_cluster_name').with_value(
'ceph')
is_expected.to contain_manila_config('cephfsnative/cephfs_enable_snapshots').with_value(
true)
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({ :osfamily => "#{os}" }))
end
it_configures 'cephfsnative driver'
end
end
end