2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-26 10:59:53 +00:00

Error if starting without quorum

If collective mode is present, but no candidates worked, still error
out.
This commit is contained in:
Jarrod Johnson 2018-06-22 15:12:42 -04:00
parent 5588712320
commit b315042850
3 changed files with 9 additions and 0 deletions

View File

@ -251,6 +251,8 @@ def start_collective():
for member in cfm.list_collective():
if member == myname:
continue
if cfm.cfgleader is None:
cfm.cfgleader = True
ldrcandidate = cfm.get_collective_member(member)['address']
connect_to_leader(name=myname, leader=ldrcandidate)

View File

@ -212,6 +212,8 @@ def _rpc_set_group_attributes(tenant, attribmap, autocreate):
ConfigManager(tenant)._true_set_group_attributes(attribmap, autocreate)
def exec_on_leader(function, *args):
if isinstance(cfgleader, bool):
raise exc.DegradedCollective()
xid = os.urandom(8)
while xid in _pendingchangesets:
xid = os.urandom(8)

View File

@ -68,6 +68,11 @@ class LockedCredentials(ConfluentException):
_apierrorstr = 'Credential store locked'
class DegradedCollective(ConfluentException):
# We are in a collective with at least half of the member nodes missing
_apierrorstr = 'Collective does not have quorum'
class ForbiddenRequest(ConfluentException):
# The client request is not allowed by authorization engine
apierrorcode = 403