]> git.proxmox.com Git - pve-ha-manager.git/commit
CRM: refactor check if state transition to active is ok
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 22 Nov 2017 10:53:08 +0000 (11:53 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 30 Jan 2018 08:33:16 +0000 (09:33 +0100)
commit30b4f397a0177f263f59094add75e15c3a38c82f
treee7ab609b4494ed0b29519c8e10115fdaa550e1ca
parent8e940b68f950f68e49aaf389e2f85ffe0c6bcb5f
CRM: refactor check if state transition to active is ok

Mainly addresses a problem where we read the manager status without
catching any possible exceptions.

As this was done only to check if our node has active fencing jobs,
which tells us that it makes no sense to even try to acquire the
manager lock - as we're fenced soon anyway.
Besides this check we always checked if we're quorate and if there
are services configured, so move
both checks in the new 'can_get_active' method, which replaces the
check_pending_fencing and the has_services method.

Move the quorum check in front and catch a possible error from the
following manager status read.
As a side effect the state transition code gets a bit shorter without
hiding the check intention.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
src/PVE/HA/CRM.pm
src/PVE/HA/Tools.pm