Handle inability to retrieve status gracefully
Tactical fix for occational segfault in ``rbd mirror pool status`` Change-Id: Ic50d06ee646ca525085fa009d344c8eabd178839 Partial-Bug: #1820976
This commit is contained in:
parent
3b102765f4
commit
cc6897b738
|
@ -79,8 +79,13 @@ class CephRBDMirrorCharm(charms_openstack.plugins.CephCharm):
|
|||
reactive.is_flag_set('ceph-local.available') and
|
||||
reactive.is_flag_set('ceph-remote.available')):
|
||||
endpoint = reactive.endpoint_from_flag('ceph-local.available')
|
||||
stats = self.mirror_pools_summary(
|
||||
self.eligible_pools(endpoint.pools))
|
||||
try:
|
||||
stats = self.mirror_pools_summary(
|
||||
self.eligible_pools(endpoint.pools))
|
||||
except subprocess.CalledProcessError as e:
|
||||
ch_core.hookenv.log('Unable to retrieve mirror pool status: '
|
||||
'"{}"'.format(e))
|
||||
return None, None
|
||||
ch_core.hookenv.log('mirror_pools_summary = "{}"'
|
||||
.format(stats),
|
||||
level=ch_core.hookenv.DEBUG)
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
import collections
|
||||
import mock
|
||||
import subprocess
|
||||
|
||||
import charms_openstack.test_utils as test_utils
|
||||
|
||||
|
@ -63,6 +64,9 @@ class TestCephRBDMirrorCharm(Helper):
|
|||
self.assertEqual(crmc.custom_assess_status_check(),
|
||||
('active', 'Unit is ready (Pools OK (1) '
|
||||
'Images Primary (2))'))
|
||||
crmc.mirror_pools_summary.side_effect = subprocess.CalledProcessError(
|
||||
42, [])
|
||||
self.assertEqual(crmc.custom_assess_status_check(), (None, None))
|
||||
|
||||
def test__mirror_pool_info(self):
|
||||
self.patch_object(ceph_rbd_mirror.socket, 'gethostname')
|
||||
|
|
Loading…
Reference in New Issue