Rename config variable to match expectation
Change-Id: I0d611ca69268357650c651677184288225f3ec8b Closes-Bug: #1716682
This commit is contained in:
parent
5700c2f988
commit
3fe9d4726d
|
@ -151,6 +151,9 @@ def get_ceph_context():
|
|||
cephcontext['public_addr'] = get_public_addr()
|
||||
cephcontext['cluster_addr'] = get_cluster_addr()
|
||||
|
||||
if config('default-rbd-features'):
|
||||
cephcontext['rbd_features'] = config('default-rbd-features')
|
||||
|
||||
# NOTE(dosaboy): these sections must correspond to what is supported in the
|
||||
# config template.
|
||||
sections = ['global', 'mds', 'mon']
|
||||
|
@ -496,8 +499,8 @@ def client_relation_joined(relid=None):
|
|||
data = {'key': ceph.get_named_key(service_name),
|
||||
'auth': config('auth-supported'),
|
||||
'ceph-public-address': public_addr}
|
||||
if config('rbd-features'):
|
||||
data['rbd_features'] = config('rbd-features')
|
||||
if config('default-rbd-features'):
|
||||
data['rbd-features'] = config('default-rbd-features')
|
||||
relation_set(relation_id=relid,
|
||||
relation_settings=data)
|
||||
else:
|
||||
|
|
|
@ -23,7 +23,8 @@ CHARM_CONFIG = {'config-flags': '',
|
|||
'use-direct-io': True,
|
||||
'osd-format': 'ext4',
|
||||
'monitor-hosts': '',
|
||||
'prefer-ipv6': False}
|
||||
'prefer-ipv6': False,
|
||||
'default-rbd-features': None}
|
||||
|
||||
|
||||
class CephHooksTestCase(unittest.TestCase):
|
||||
|
@ -57,6 +58,36 @@ class CephHooksTestCase(unittest.TestCase):
|
|||
'use_syslog': 'true'}
|
||||
self.assertEqual(ctxt, expected)
|
||||
|
||||
@patch.object(ceph_hooks, 'get_public_addr', lambda *args: "10.0.0.1")
|
||||
@patch.object(ceph_hooks, 'get_cluster_addr', lambda *args: "10.1.0.1")
|
||||
@patch.object(ceph_hooks, 'cmp_pkgrevno',
|
||||
lambda pkg, ver: -1 if ver == '12.1.0' else 1)
|
||||
@patch.object(ceph_hooks, 'get_mon_hosts', lambda *args: ['10.0.0.1',
|
||||
'10.0.0.2'])
|
||||
@patch.object(ceph_hooks, 'get_networks', lambda *args: "")
|
||||
@patch.object(ceph_hooks, 'leader_get', lambda *args: '1234')
|
||||
@patch.object(ceph, 'config')
|
||||
@patch.object(ceph_hooks, 'config')
|
||||
def test_get_ceph_context_rbd_features(self, mock_config, mock_config2):
|
||||
config = copy.deepcopy(CHARM_CONFIG)
|
||||
config['default-rbd-features'] = 1
|
||||
mock_config.side_effect = lambda key: config[key]
|
||||
mock_config2.side_effect = lambda key: config[key]
|
||||
ctxt = ceph_hooks.get_ceph_context()
|
||||
expected = {'auth_supported': False,
|
||||
'ceph_cluster_network': '',
|
||||
'ceph_public_network': '',
|
||||
'cluster_addr': '10.1.0.1',
|
||||
'dio': 'true',
|
||||
'fsid': '1234',
|
||||
'loglevel': 1,
|
||||
'mon_hosts': '10.0.0.1 10.0.0.2',
|
||||
'old_auth': False,
|
||||
'public_addr': '10.0.0.1',
|
||||
'use_syslog': 'true',
|
||||
'rbd_features': 1}
|
||||
self.assertEqual(ctxt, expected)
|
||||
|
||||
@patch.object(ceph_hooks, 'get_public_addr', lambda *args: "10.0.0.1")
|
||||
@patch.object(ceph_hooks, 'get_cluster_addr', lambda *args: "10.1.0.1")
|
||||
@patch.object(ceph_hooks, 'cmp_pkgrevno', lambda *args: 1)
|
||||
|
|
Loading…
Reference in New Issue