INNER CODE UNIT · Python
check_reactor_can_read_drbd
LINBIT/linstor-server · scripts/linstor-controller-ha-setup.py:355
def check_reactor_can_read_drbd():
"""drbd-reactor drives the promoter off 'drbdsetup status --json'. When
drbd-utils is too old for the installed reactor, that output cannot be
deserialized and reactor just logs 'IGNORING resource ...' — the promoter
then never fails over, with nothing obviously broken. Warn (not fail): the
exact version pairing is not something this script can rule on."""
try:
resources = json.loads(out(["drbdsetup", "status", "--json"]))
except Exception:
print("WARNING: 'drbdsetup status --json' did not return usable JSON. "
"drbd-reactor needs it to track the resource; check that "
"drbd-utils and drbd-reactor versions fit together.")
return
needed = {"name", "role", "devices", "connections"}
for res in resources:
if not needed.issubset(res.keys()):
print("WARNING: 'drbdsetup status --json' is missing fields "
+ ", ".join(sorted(needed - set(res.keys())))