File: manila_backend_cephfs_spec.rb

package info (click to toggle)
puppet-module-manila 27.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,852 kB
  • sloc: ruby: 5,060; python: 33; makefile: 10; sh: 10
file content (111 lines) | stat: -rw-r--r-- 4,841 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
require 'spec_helper'

describe 'manila::backend::cephfs' do

  shared_examples_for 'manila::backend::cephfs' do
    let(:title) {'cephfs'}

    let :params do
      {
        :driver_handles_share_servers                     => false,
        :share_backend_name                               => 'cephfs',
        :backend_availability_zone                        => 'my_zone',
        :cephfs_conf_path                                 => '$state_path/ceph.conf',
        :cephfs_auth_id                                   => 'manila',
        :cephfs_cluster_name                              => 'ceph',
        :cephfs_protocol_helper_type                      => 'NFS',
        :cephfs_ganesha_server_ip                         => '10.0.0.1',
        :cephfs_ganesha_export_ips                        => '10.0.0.1,1001::1001',
        :cephfs_ganesha_server_is_remote                  => true,
        :cephfs_ganesha_server_username                   => 'ganeshadmin',
        :cephfs_ganesha_path_to_private_key               => '/readable/by/manila.key',
        :cephfs_nfs_cluster_id                            => 'mycephfsnfscluster',
        :cephfs_volume_mode                               => '0775',
        :cephfs_filesystem_name                           => 'cephfs',
        :cephfs_cached_allocated_capacity_update_interval => 60,
        :reserved_share_percentage                        => 10.0,
        :reserved_share_from_snapshot_percentage          => 10.1,
        :reserved_share_extend_percentage                 => 10.2,
      }
    end

    it 'installs ceph-common' do
      is_expected.to contain_package('ceph-common').with(
        :name   => platform_params[:ceph_common_package_name],
        :ensure => 'installed',
      )
    end

    it 'configures cephfs driver' do
      is_expected.to contain_manila_config('cephfs/share_driver').with_value(
        'manila.share.drivers.cephfs.driver.CephFSDriver')
      is_expected.to contain_manila_config('cephfs/share_backend_name').with_value(
        'cephfs')
      is_expected.to contain_manila_config('cephfs/backend_availability_zone').with_value(
        'my_zone')
      is_expected.to contain_manila_config('cephfs/cephfs_conf_path').with_value(
        '$state_path/ceph.conf')
      is_expected.to contain_manila_config('cephfs/cephfs_auth_id').with_value(
        'manila')
      is_expected.to contain_manila_config('cephfs/cephfs_cluster_name').with_value(
        'ceph')
      is_expected.to contain_manila_config('cephfs/cephfs_protocol_helper_type').with_value(
        'NFS')
      is_expected.to contain_manila_config('cephfs/cephfs_ganesha_server_ip').with_value(
        '10.0.0.1')
      is_expected.to contain_manila_config('cephfs/cephfs_ganesha_export_ips').with_value(
        '10.0.0.1,1001::1001')
      is_expected.to contain_manila_config('cephfs/cephfs_volume_mode').with_value(
        '0775')
      is_expected.to contain_manila_config('cephfs/cephfs_ganesha_server_is_remote').with_value(
        true)
      is_expected.to contain_manila_config('cephfs/cephfs_ganesha_server_username').with_value(
        'ganeshadmin')
      is_expected.to contain_manila_config('cephfs/cephfs_ganesha_path_to_private_key').with_value(
        '/readable/by/manila.key')
      is_expected.to contain_manila_config('cephfs/cephfs_nfs_cluster_id').with_value(
        'mycephfsnfscluster')
      is_expected.to contain_manila_config('cephfs/cephfs_filesystem_name').with_value(
        'cephfs')
      is_expected.to contain_manila_config('cephfs/cephfs_cached_allocated_capacity_update_interval').with_value(
        60)
      is_expected.to contain_manila_config('cephfs/reserved_share_percentage').with_value(10.0)
      is_expected.to contain_manila_config('cephfs/reserved_share_from_snapshot_percentage').with_value(10.1)
      is_expected.to contain_manila_config('cephfs/reserved_share_extend_percentage').with_value(10.2)
    end

    context 'with cephfs_ganesha_export_ips set by array' do
      before do
        params.merge!({
          :cephfs_ganesha_export_ips => ['10.0.0.1', '1001::1001']
        })
      end

      it 'configures cephfs_ganesha_export_ips' do
        is_expected.to contain_manila_config('cephfs/cephfs_ganesha_export_ips').with_value(
          '10.0.0.1,1001::1001')
      end
    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

      let :platform_params do
        case facts[:os]['family']
        when 'Debian'
          { :ceph_common_package_name => 'ceph-common' }
        when 'RedHat'
          { :ceph_common_package_name => 'ceph-common' }
        end
      end

      it_configures 'manila::backend::cephfs'
    end
  end
end