Browse Source

Use proper ceph.conf generated by ceph-backup relation

When a primary Ceph cluster is used as a volume backend and a secondary
cluster as a backup backend, target Ceph mon addresses will be
different. But previously both Cinder volume and backup services use the
same /etc/ceph/ceph.conf generated by cinder-ceph and ceph-mon relation.
Instead, use separete ceph.conf files based on relation types.

Change-Id: I1d82db179b41b0c01d2a217838384ac71ef7bdad
Closes-Bug: #1713489
changes/26/498526/3
Nobuto Murata 1 year ago
parent
commit
14f6f2885b

+ 5
- 0
hooks/cinder_backup_contexts.py View File

@@ -12,6 +12,8 @@
12 12
 # See the License for the specific language governing permissions and
13 13
 # limitations under the License.
14 14
 
15
+import os
16
+
15 17
 from charmhelpers.core.hookenv import (
16 18
     service_name,
17 19
     is_relation_made,
@@ -47,6 +49,9 @@ class CephBackupSubordinateContext(OSContextGenerator):
47 49
                     "sections": {
48 50
                         'DEFAULT': [
49 51
                             ('backup_driver', backup_driver),
52
+                            ('backup_ceph_conf',
53
+                                os.path.join('/var/lib/charm',
54
+                                             service, 'ceph.conf')),
50 55
                             ('backup_ceph_pool', service),
51 56
                             ('backup_ceph_user', service),
52 57
                         ]

+ 2
- 0
tests/basic_deployment.py View File

@@ -400,6 +400,8 @@ class CinderBackupBasicDeployment(OpenStackAmuletDeployment):
400 400
         sub = ('{"cinder": {"/etc/cinder/cinder.conf": {"sections": '
401 401
                '{"DEFAULT": ['
402 402
                '["backup_driver", "cinder.backup.drivers.ceph"], '
403
+               '["backup_ceph_conf", '
404
+               '"/var/lib/charm/cinder-backup/ceph.conf"], '
403 405
                '["backup_ceph_pool", "cinder-backup"], '
404 406
                '["backup_ceph_user", "cinder-backup"]]}}}}')
405 407
         expected = {

+ 3
- 0
unit_tests/test_cinder_backup_contexts.py View File

@@ -38,6 +38,9 @@ class TestCinderBackupContext(CharmTestCase):
38 38
                           {'sections': {'DEFAULT':
39 39
                                         [('backup_driver',
40 40
                                           'cinder.backup.drivers.ceph'),
41
+                                         ('backup_ceph_conf',
42
+                                          '/var/lib/charm/'
43
+                                          'cinder-backup-ut/ceph.conf'),
41 44
                                          ('backup_ceph_pool',
42 45
                                           'cinder-backup-ut'),
43 46
                                          ('backup_ceph_user',

Loading…
Cancel
Save