]> git.proxmox.com Git - pve-ha-manager.git/commit
cleanup backup & mounted locks after recovery (fixes #1100)
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 15 Sep 2016 08:45:15 +0000 (10:45 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 15 Sep 2016 11:12:58 +0000 (13:12 +0200)
commit5dd3ed863a162bf78e59c5dc550f2f708b3cbfe2
treec3cf29fdc773a7c743f87c133c820fced7fbce24
parentcde11324ffccfbc63c5f5ab0ee0b17a34276e3fd
cleanup backup & mounted locks after recovery (fixes #1100)

This cleans up the backup and mounted locks after a service is
recovered from a failed node, else it may not start if a locked
action occurred during the node failure.
We allow deletion of backup and mounted locks as they are secure
to do so if the node which hosted the locked service is now fenced.
We do not allow snapshot lock deletion as this needs more manual
clean up, also they are normally triggered manually.
Further ignore migration locks for now, we should over think that but
as its a manual triggered action for now it should be OK to not
auto delete it.

We do cannot remove locks via the remove_lock method provided by
PVE::AbstractConfig, as this method is well behaved and does not
allows removing locks from VMs/CTs located on another node.  We also
do not want to adapt this method to allow arbitrary lock removing,
independent on which node the config is located, as this could cause
missuse in the future. After all one of our base principles is that
the node owns its VMs/CTs (and there configs) and only the owner
itself may change the status of a VM/CT.

The HA manager needs to be able to change the state of services
when a node failed and is also allowed to do so, but only if the
node is fenced and we need to recover a service from it.

So we (re)implement the remove lock functionality in the resource
plugins.
We call that only if a node was fenced, and only *previous* stealing
the service. After all our implication to remove a lock is that the
owner (the node) is fenced. After stealing it we already changed
owner, and the new owner is *not* fenced and thus our implication
does not hold anymore - the new owner may already do some stuff
with the service (config changes, etc.)

Add the respective log.expect output from the added test to enable
regression testing this issue.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/HA/Manager.pm
src/PVE/HA/Resources.pm
src/PVE/HA/Resources/PVECT.pm
src/PVE/HA/Resources/PVEVM.pm
src/PVE/HA/Sim/Resources.pm
src/test/test-locked-service1/log.expect [new file with mode: 0644]