Browse Source

Merge "Add support for cinder RBD driver parameter"

tags/11.2.0
Zuul 1 month ago
parent
commit
d667bad643

+ 29
- 21
manifests/profile/base/cinder/volume/rbd.pp View File

@@ -51,45 +51,53 @@
51 51
 #   (Optional) The user name for the RBD client
52 52
 #   Defaults to 'openstack'
53 53
 #
54
+# [*cinder_rbd_flatten_volume_from_snapshot*]
55
+#   (Optional) Whether volumes created from a snapshot should be flattened
56
+#   in order to remove a dependency on the snapshot.
57
+#   Defaults to hiera('cinder::backend::rbd::flatten_volume_from_snapshot, undef)
58
+#
54 59
 # [*step*]
55 60
 #   (Optional) The current step in deployment. See tripleo-heat-templates
56 61
 #   for more details.
57 62
 #   Defaults to hiera('step')
58 63
 #
59 64
 class tripleo::profile::base::cinder::volume::rbd (
60
-  $backend_name              = hiera('cinder::backend::rbd::volume_backend_name', 'tripleo_ceph'),
61
-  $backend_availability_zone = hiera('cinder::backend::rbd::backend_availability_zone', undef),
65
+  $backend_name                            = hiera('cinder::backend::rbd::volume_backend_name', 'tripleo_ceph'),
66
+  $backend_availability_zone               = hiera('cinder::backend::rbd::backend_availability_zone', undef),
62 67
   # lint:ignore:parameter_documentation
63
-  $cinder_rbd_backend_host   = hiera('cinder::backend_host', hiera('cinder::host', $::hostname)),
68
+  $cinder_rbd_backend_host                 = hiera('cinder::backend_host', hiera('cinder::host', $::hostname)),
64 69
   # lint:endignore
65
-  $cinder_rbd_ceph_conf      = hiera('cinder::backend::rbd::rbd_ceph_conf', '/etc/ceph/ceph.conf'),
66
-  $cinder_rbd_pool_name      = 'volumes',
67
-  $cinder_rbd_extra_pools    = undef,
68
-  $cinder_rbd_secret_uuid    = undef,
69
-  $cinder_rbd_user_name      = 'openstack',
70
-  $step                      = Integer(hiera('step')),
70
+  $cinder_rbd_ceph_conf                    = hiera('cinder::backend::rbd::rbd_ceph_conf', '/etc/ceph/ceph.conf'),
71
+  $cinder_rbd_pool_name                    = 'volumes',
72
+  $cinder_rbd_extra_pools                  = undef,
73
+  $cinder_rbd_secret_uuid                  = undef,
74
+  $cinder_rbd_user_name                    = 'openstack',
75
+  $cinder_rbd_flatten_volume_from_snapshot = hiera('cinder::backend::rbd::flatten_volume_from_snapshot', undef),
76
+  $step                                    = Integer(hiera('step')),
71 77
 ) {
72 78
   include ::tripleo::profile::base::cinder::volume
73 79
 
74 80
   if $step >= 4 {
75 81
     cinder::backend::rbd { $backend_name :
76
-      backend_availability_zone => $backend_availability_zone,
77
-      backend_host              => $cinder_rbd_backend_host,
78
-      rbd_ceph_conf             => $cinder_rbd_ceph_conf,
79
-      rbd_pool                  => $cinder_rbd_pool_name,
80
-      rbd_user                  => $cinder_rbd_user_name,
81
-      rbd_secret_uuid           => $cinder_rbd_secret_uuid,
82
+      backend_availability_zone        => $backend_availability_zone,
83
+      backend_host                     => $cinder_rbd_backend_host,
84
+      rbd_ceph_conf                    => $cinder_rbd_ceph_conf,
85
+      rbd_pool                         => $cinder_rbd_pool_name,
86
+      rbd_user                         => $cinder_rbd_user_name,
87
+      rbd_secret_uuid                  => $cinder_rbd_secret_uuid,
88
+      rbd_flatten_volume_from_snapshot => $cinder_rbd_flatten_volume_from_snapshot,
82 89
     }
83 90
 
84 91
     if $cinder_rbd_extra_pools {
85 92
       $cinder_rbd_extra_pools.each |$pool_name| {
86 93
         cinder::backend::rbd { "${backend_name}_${pool_name}" :
87
-          backend_availability_zone => $backend_availability_zone,
88
-          backend_host              => $cinder_rbd_backend_host,
89
-          rbd_ceph_conf             => $cinder_rbd_ceph_conf,
90
-          rbd_pool                  => $pool_name,
91
-          rbd_user                  => $cinder_rbd_user_name,
92
-          rbd_secret_uuid           => $cinder_rbd_secret_uuid,
94
+          backend_availability_zone        => $backend_availability_zone,
95
+          backend_host                     => $cinder_rbd_backend_host,
96
+          rbd_ceph_conf                    => $cinder_rbd_ceph_conf,
97
+          rbd_pool                         => $pool_name,
98
+          rbd_user                         => $cinder_rbd_user_name,
99
+          rbd_secret_uuid                  => $cinder_rbd_secret_uuid,
100
+          rbd_flatten_volume_from_snapshot => $cinder_rbd_flatten_volume_from_snapshot,
93 101
         }
94 102
       }
95 103
     }

+ 35
- 30
spec/classes/tripleo_profile_base_cinder_volume_rbd_spec.rb View File

@@ -41,10 +41,11 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
41 41
       context 'with defaults' do
42 42
         it 'should trigger complete configuration' do
43 43
           is_expected.to contain_cinder__backend__rbd('tripleo_ceph').with(
44
-            :backend_host    => 'node.example.com',
45
-            :rbd_ceph_conf   => '/etc/ceph/ceph.conf',
46
-            :rbd_pool        => 'volumes',
47
-            :rbd_user        => 'openstack',
44
+            :backend_host                     => 'node.example.com',
45
+            :rbd_ceph_conf                    => '/etc/ceph/ceph.conf',
46
+            :rbd_pool                         => 'volumes',
47
+            :rbd_user                         => 'openstack',
48
+            :rbd_flatten_volume_from_snapshot => '<SERVICE DEFAULT>',
48 49
           )
49 50
         end
50 51
       end
@@ -52,40 +53,44 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
52 53
       context 'with customizations' do
53 54
         before :each do
54 55
           params.merge!({
55
-            :backend_name              => 'poodles',
56
-            :backend_availability_zone => 'my_zone',
57
-            :cinder_rbd_backend_host   => 'fe80::fc54:ff:fe9e:7846',
58
-            :cinder_rbd_ceph_conf      => '/etc/ceph/mycluster.conf',
59
-            :cinder_rbd_pool_name      => 'poolname',
60
-            :cinder_rbd_extra_pools    => ['aplenty', 'galore'],
61
-            :cinder_rbd_secret_uuid    => 'secretuuid',
62
-            :cinder_rbd_user_name      => 'kcatsnepo'
56
+            :backend_name                            => 'poodles',
57
+            :backend_availability_zone               => 'my_zone',
58
+            :cinder_rbd_backend_host                 => 'fe80::fc54:ff:fe9e:7846',
59
+            :cinder_rbd_ceph_conf                    => '/etc/ceph/mycluster.conf',
60
+            :cinder_rbd_pool_name                    => 'poolname',
61
+            :cinder_rbd_extra_pools                  => ['aplenty', 'galore'],
62
+            :cinder_rbd_secret_uuid                  => 'secretuuid',
63
+            :cinder_rbd_user_name                    => 'kcatsnepo',
64
+            :cinder_rbd_flatten_volume_from_snapshot => true,
63 65
           })
64 66
         end
65 67
         it 'should trigger complete configuration' do
66 68
           is_expected.to contain_cinder__backend__rbd('poodles').with(
67
-            :backend_host              => 'fe80::fc54:ff:fe9e:7846',
68
-            :backend_availability_zone => 'my_zone',
69
-            :rbd_ceph_conf             => '/etc/ceph/mycluster.conf',
70
-            :rbd_pool                  => 'poolname',
71
-            :rbd_user                  => 'kcatsnepo',
72
-            :rbd_secret_uuid           => 'secretuuid'
69
+            :backend_host                     => 'fe80::fc54:ff:fe9e:7846',
70
+            :backend_availability_zone        => 'my_zone',
71
+            :rbd_ceph_conf                    => '/etc/ceph/mycluster.conf',
72
+            :rbd_pool                         => 'poolname',
73
+            :rbd_user                         => 'kcatsnepo',
74
+            :rbd_secret_uuid                  => 'secretuuid',
75
+            :rbd_flatten_volume_from_snapshot => true,
73 76
           )
74 77
           is_expected.to contain_cinder__backend__rbd('poodles_aplenty').with(
75
-            :backend_host              => 'fe80::fc54:ff:fe9e:7846',
76
-            :backend_availability_zone => 'my_zone',
77
-            :rbd_ceph_conf             => '/etc/ceph/mycluster.conf',
78
-            :rbd_pool                  => 'aplenty',
79
-            :rbd_user                  => 'kcatsnepo',
80
-            :rbd_secret_uuid           => 'secretuuid'
78
+            :backend_host                     => 'fe80::fc54:ff:fe9e:7846',
79
+            :backend_availability_zone        => 'my_zone',
80
+            :rbd_ceph_conf                    => '/etc/ceph/mycluster.conf',
81
+            :rbd_pool                         => 'aplenty',
82
+            :rbd_user                         => 'kcatsnepo',
83
+            :rbd_secret_uuid                  => 'secretuuid',
84
+            :rbd_flatten_volume_from_snapshot => true,
81 85
           )
82 86
           is_expected.to contain_cinder__backend__rbd('poodles_galore').with(
83
-            :backend_host              => 'fe80::fc54:ff:fe9e:7846',
84
-            :backend_availability_zone => 'my_zone',
85
-            :rbd_ceph_conf             => '/etc/ceph/mycluster.conf',
86
-            :rbd_pool                  => 'galore',
87
-            :rbd_user                  => 'kcatsnepo',
88
-            :rbd_secret_uuid           => 'secretuuid'
87
+            :backend_host                     => 'fe80::fc54:ff:fe9e:7846',
88
+            :backend_availability_zone        => 'my_zone',
89
+            :rbd_ceph_conf                    => '/etc/ceph/mycluster.conf',
90
+            :rbd_pool                         => 'galore',
91
+            :rbd_user                         => 'kcatsnepo',
92
+            :rbd_secret_uuid                  => 'secretuuid',
93
+            :rbd_flatten_volume_from_snapshot => true,
89 94
           )
90 95
         end
91 96
       end

Loading…
Cancel
Save