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
This commit is contained in:
Nobuto Murata 2017-08-28 23:51:45 +07:00
parent bbe3fae336
commit 14f6f2885b
3 changed files with 10 additions and 0 deletions

View File

@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from charmhelpers.core.hookenv import (
service_name,
is_relation_made,
@ -47,6 +49,9 @@ class CephBackupSubordinateContext(OSContextGenerator):
"sections": {
'DEFAULT': [
('backup_driver', backup_driver),
('backup_ceph_conf',
os.path.join('/var/lib/charm',
service, 'ceph.conf')),
('backup_ceph_pool', service),
('backup_ceph_user', service),
]

View File

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

View File

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