Set waiting status when number of OSDs has not yet reached expected-osd-count
The charm does not process relation requests from clients when the number of OSDs has not yet reached the expected-osd-count. Make this situation clear to the user by setting the charm status to waiting with relevant information. Change-Id: I638547ca4a9f1bf48782c82aa0d92f89f6bfd13a Closes-Bug: 1807652
This commit is contained in:
parent
35c8e40e83
commit
1a250e81a5
|
@ -793,7 +793,13 @@ def assess_status():
|
|||
|
||||
# active - bootstrapped + quorum status check
|
||||
if ceph.is_bootstrapped() and ceph.is_quorum():
|
||||
status_set('active', 'Unit is ready and clustered')
|
||||
expected_osd_count = config('expected-osd-count') or 3
|
||||
if sufficient_osds(expected_osd_count):
|
||||
status_set('active', 'Unit is ready and clustered')
|
||||
else:
|
||||
status_set('waiting', 'Monitor bootstrapped but waiting for number'
|
||||
'of OSDs to reach expected-osd-count ({})'
|
||||
.format(expected_osd_count))
|
||||
else:
|
||||
# Unit should be running and clustered, but no quorum
|
||||
# TODO: should this be blocked or waiting?
|
||||
|
|
|
@ -81,18 +81,24 @@ class ServiceStatusTestCase(test_utils.CharmTestCase):
|
|||
self.status_set.assert_called_with('waiting', mock.ANY)
|
||||
self.application_version_set.assert_called_with('10.2.2')
|
||||
|
||||
@mock.patch.object(hooks, 'sufficient_osds')
|
||||
@mock.patch.object(hooks, 'get_peer_units')
|
||||
def test_assess_status_peers_complete_active(self, _peer_units):
|
||||
def test_assess_status_peers_complete_active(self, _peer_units,
|
||||
_sufficient_osds):
|
||||
_peer_units.return_value = ENOUGH_PEERS_COMPLETE
|
||||
_sufficient_osds.return_value = True
|
||||
self.ceph.is_bootstrapped.return_value = True
|
||||
self.ceph.is_quorum.return_value = True
|
||||
hooks.assess_status()
|
||||
self.status_set.assert_called_with('active', mock.ANY)
|
||||
self.application_version_set.assert_called_with('10.2.2')
|
||||
|
||||
@mock.patch.object(hooks, 'sufficient_osds')
|
||||
@mock.patch.object(hooks, 'get_peer_units')
|
||||
def test_assess_status_peers_complete_down(self, _peer_units):
|
||||
def test_assess_status_peers_complete_down(self, _peer_units,
|
||||
_sufficient_osds):
|
||||
_peer_units.return_value = ENOUGH_PEERS_COMPLETE
|
||||
_sufficient_osds.return_value = True
|
||||
self.ceph.is_bootstrapped.return_value = False
|
||||
self.ceph.is_quorum.return_value = False
|
||||
hooks.assess_status()
|
||||
|
|
Loading…
Reference in New Issue