]> git.proxmox.com Git - pve-ha-manager.git/log
pve-ha-manager.git
5 years agod/control: remove unused libsystemd-dev from build dependencies
Thomas Lamprecht [Thu, 21 Mar 2019 12:18:37 +0000 (13:18 +0100)]
d/control: remove unused libsystemd-dev from build dependencies

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agolrm: exit on restart and agent lock lost for > 90s
Thomas Lamprecht [Fri, 15 Mar 2019 09:48:44 +0000 (10:48 +0100)]
lrm: exit on restart and agent lock lost for > 90s

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agoPVE2 Env: get_ha_settings: don't die if pmxcfs failed
Thomas Lamprecht [Fri, 15 Mar 2019 08:43:28 +0000 (09:43 +0100)]
PVE2 Env: get_ha_settings: don't die if pmxcfs failed

This is a method called in our shutdown path, so if we die here we
may silent a shutdown, nad just ignore it.
In combination with the fact that our service unit is configured
with: 'TimeoutStopSec=infinity' this means that a systemctl stop may
wait infinitely for this to happen, and any other systemctl command
will be queued for that long.

So if pmxcfs is stopped, we then get a shutdown request, we cannot
start pmxcfs again, at least not through systemd.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agotreewide trailing whitespace cleanup
Thomas Lamprecht [Thu, 14 Mar 2019 12:18:03 +0000 (13:18 +0100)]
treewide trailing whitespace cleanup

generated by: find . -name '*.pm' -exec sed -i 's/\s*$//g' {} \;

As I touched almost any file here anyway I'm not scared to appear in
git blame ;-) also it has support to suppress whitespace changes.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agobump version to 2.0-8
Thomas Lamprecht [Wed, 6 Mar 2019 07:03:32 +0000 (08:03 +0100)]
bump version to 2.0-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agod/control: do not track qemu-server and pve-container dependency
Thomas Lamprecht [Wed, 6 Mar 2019 06:51:46 +0000 (07:51 +0100)]
d/control: do not track qemu-server and pve-container dependency

While it would be correct to have them tracked here we cannot do this
at the moment, as with those two also depend on pve-ha-manager, and
with dpkg packaged under strech there's an issue with such cyclic
dependencies and trigger cycle detection only resolved for buster[0]

Currently, the issue exists on the following condition:

* update of pve-ha-manager plus either pve-container or qemu-server
* but _no_ update of pve-manager in the same upgrade cycle

[0]: https://salsa.debian.org/dpkg-team/dpkg/commit/7f43bf5f93c857bdb419892abfc014a5e9c3c273

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agobump version to 2.0-7
Thomas Lamprecht [Mon, 4 Mar 2019 09:36:41 +0000 (10:36 +0100)]
bump version to 2.0-7

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agod/control: bump version dependency to pve-doc-generator
Thomas Lamprecht [Fri, 22 Feb 2019 12:31:32 +0000 (13:31 +0100)]
d/control: bump version dependency to pve-doc-generator

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years ago1891 Add zsh command completion for ha-manager CLI tools
Christian Ebner [Thu, 21 Feb 2019 13:25:00 +0000 (14:25 +0100)]
1891 Add zsh command completion for ha-manager CLI tools

Add the zsh command completion generation for the ha-manager CLI tools.

This adds the automatic generation of the autocompletion scripts for zsh

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
5 years agoapi: delete resource: refactor and cleanup indentation
Thomas Lamprecht [Wed, 23 Jan 2019 12:42:11 +0000 (13:42 +0100)]
api: delete resource: refactor and cleanup indentation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agofix #1602: allow to delete 'ignored' services over API
Thomas Lamprecht [Wed, 23 Jan 2019 09:34:40 +0000 (10:34 +0100)]
fix #1602: allow to delete 'ignored' services over API

service_is_ha_managed returns false if a service is in the resource
configuration but marked as 'ignore', as for the internal stack it is
as it wasn't HA managed at all.

But user should be able to remvoe it from the configuration easily
even in this state, without setting the requesttate to anything else
first.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agofix #1794: VM resource: catch qmp command exceptions
Thomas Lamprecht [Wed, 23 Jan 2019 12:50:14 +0000 (13:50 +0100)]
fix #1794: VM resource: catch qmp command exceptions

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agoapi: resource migrate: add description for node parameter
Thomas Lamprecht [Thu, 24 Jan 2019 13:18:55 +0000 (14:18 +0100)]
api: resource migrate: add description for node parameter

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agofix #1842: do not pass forceStop to CT shutdown
Thomas Lamprecht [Wed, 23 Jan 2019 08:43:14 +0000 (09:43 +0100)]
fix #1842: do not pass forceStop to CT shutdown

The vm_shutdown parameter forceStop differs in behaviour between VMs
and CTs. While on VMs it ensures that a VM gets stoppped if it could
not shutdown gracefully only after the timeout passed, the container
stack always ignores any timeout if forceStop is set and hard stops
the CT immediately.
To achieve this behaviour for CTs too, the timeout is enough, as
lxc-stop then does the hard stop after timeout itself.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agofence cfg: count_devices: improve comment
Thomas Lamprecht [Sun, 13 Jan 2019 12:17:12 +0000 (13:17 +0100)]
fence cfg: count_devices: improve comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agofence cfg parser: check command explicit, mark fence_all as todo
Thomas Lamprecht [Sun, 13 Jan 2019 12:06:05 +0000 (13:06 +0100)]
fence cfg parser: check command explicit, mark fence_all as todo

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agofence config parser: output all errors at once
Thomas Lamprecht [Sun, 13 Jan 2019 11:44:56 +0000 (12:44 +0100)]
fence config parser: output all errors at once

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agofence config parser: early return on ignored devices
Thomas Lamprecht [Sun, 13 Jan 2019 11:39:53 +0000 (12:39 +0100)]
fence config parser: early return on ignored devices

We do not support all of the dlm.conf possibilities, but we also do
not want to die on such "unkown" keys/commands as an admin should be
able to share this config if it is already used for other purposes,
e.g. lockd, gfs, or such.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agoFenceConfig: move line parsing out to closure
Thomas Lamprecht [Sun, 13 Jan 2019 11:30:36 +0000 (12:30 +0100)]
FenceConfig: move line parsing out to closure

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agoFenceConfig: whitespace cleanup
Thomas Lamprecht [Sun, 13 Jan 2019 11:29:08 +0000 (12:29 +0100)]
FenceConfig: whitespace cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agoFenceConfig: early return if file is empty
Thomas Lamprecht [Sun, 13 Jan 2019 11:21:26 +0000 (12:21 +0100)]
FenceConfig: early return if file is empty

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agod/lintian-overrids: add repeated-trigger-name override
Thomas Lamprecht [Tue, 4 Sep 2018 09:21:04 +0000 (11:21 +0200)]
d/lintian-overrids: add repeated-trigger-name override

in this package we provide api functions, thus we want to activate
the pve-api-update trigger, so that packages like pve-manager get
notified about it. But we also use api functions directly so we setup
an interest in the pve-api-update trigger. This results in an lintian
error (lintian version from buster or newer) which we can override:

> [...]
> This tag is also triggered if the package has an activate trigger
> for something on which it also declares an interest. The only (but
> rather unlikely) reason to do this is if another package also
> declares an interest and this package needs to activate that other
> package. If the package is using it for this exact purpose, then
> please use a Lintian override to state this.
-- https://lintian.debian.org/tags/repeated-trigger-name.html

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agosim: show sent emails in regression tests
Thomas Lamprecht [Fri, 27 Jan 2017 10:51:28 +0000 (11:51 +0100)]
sim: show sent emails in regression tests

its good to check if any regression regarding sendmail happened, as
it can be annoying if a sendmail loop happens.

5 years agofence config: allow to pass arguments to fence agents via short-opts
Thomas Lamprecht [Tue, 8 Jan 2019 14:21:48 +0000 (15:21 +0100)]
fence config: allow to pass arguments to fence agents via short-opts

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agod/control: add missing pve-container dependency
Thomas Lamprecht [Tue, 4 Sep 2018 09:27:00 +0000 (11:27 +0200)]
d/control: add missing pve-container dependency

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agofencing: fixup run_fence_jobs
Thomas Lamprecht [Tue, 4 Sep 2018 09:28:05 +0000 (11:28 +0200)]
fencing: fixup run_fence_jobs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agofixup changelog line length and typos
Thomas Lamprecht [Mon, 7 Jan 2019 12:35:34 +0000 (13:35 +0100)]
fixup changelog line length and typos

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agobump version 2.0-6
Thomas Lamprecht [Mon, 7 Jan 2019 12:00:00 +0000 (13:00 +0100)]
bump version 2.0-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agofixup parse_sid call
Wolfgang Bumiller [Mon, 7 Jan 2019 11:04:24 +0000 (12:04 +0100)]
fixup parse_sid call

This call was missed in the commit moving it from
PVE::HA::Tools to PVE::HA:Config.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Fixes: 0087839aa530 ("Tools: remove dependency on PVE::Cluster")
5 years agofollowup code cleanup
Thomas Lamprecht [Mon, 7 Jan 2019 11:07:03 +0000 (12:07 +0100)]
followup code cleanup

addresses a few nits from Fabians review at:
https://pve.proxmox.com/pipermail/pve-devel/2018-December/035061.html
https://pve.proxmox.com/pipermail/pve-devel/2018-December/035085.html

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agolrm: explicitly log shutdown_policy on node shutdown
Thomas Lamprecht [Thu, 20 Dec 2018 07:44:43 +0000 (08:44 +0100)]
lrm: explicitly log shutdown_policy on node shutdown

Makes regression test a bit more telling and it helps to be verbose
for an user here too.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agofix #1378: allow to specify a service shutdown policy
Thomas Lamprecht [Thu, 20 Dec 2018 07:44:42 +0000 (08:44 +0100)]
fix #1378: allow to specify a service shutdown policy

Allow an admin to set a datacenter wide HA policy which can change
the way we handle services on a node shutdown.

There's:

* freeze: always freeze servivces, independent of the shutdown type
  (reboot, poweroff)
* failover: never freeze services, this means that a service will get
  recovered to another node if possible and if the current node does
  not comes back up in the grace period of 1 minute.
* default: this is the current behavior, freeze on reboot but do not
  freeze on poweroff

Add to tests, shutdown-policy1 which is based of the reboot1 test,
but enforces no freeze with a failover policy, and shutdown-policy2
which is based on the shutdown1 test but with a explicit freeze
policy. You can compare (diff) each tests log result to the test it's
based on to see what changes.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agoEnv: add get_ha_settings method
Thomas Lamprecht [Thu, 20 Dec 2018 07:44:41 +0000 (08:44 +0100)]
Env: add get_ha_settings method

Add get_ha_settings, a method which returns the datacenter wide HA
settings

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agoAdd missing Build-Depends
Rhonda D'Vine [Fri, 14 Dec 2018 14:52:32 +0000 (15:52 +0100)]
Add missing Build-Depends

Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
5 years agoinstall simulator executable into bin not sbin
Thomas Lamprecht [Wed, 17 Oct 2018 09:51:04 +0000 (11:51 +0200)]
install simulator executable into bin not sbin

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agoTools: add note about indirect include of Config module
Thomas Lamprecht [Wed, 17 Oct 2018 09:41:44 +0000 (11:41 +0200)]
Tools: add note about indirect include of Config module

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agobuild: actually ship SOURCE file
Fabian Grünbichler [Wed, 10 Oct 2018 11:55:07 +0000 (13:55 +0200)]
build: actually ship SOURCE file

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 years agobuild: bump compat level to 10
Fabian Grünbichler [Wed, 10 Oct 2018 11:55:06 +0000 (13:55 +0200)]
build: bump compat level to 10

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 years agobuild: restructure packaging
Fabian Grünbichler [Wed, 10 Oct 2018 11:55:05 +0000 (13:55 +0200)]
build: restructure packaging

use dpkg-buildpackage and debhelper properly, add missing dependencies and
embed used perl modules from libpve-common-perl to make pve-ha-simulator
standalone.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 years agoTools: remove dependency on PVE::Cluster
Fabian Grünbichler [Wed, 10 Oct 2018 11:55:04 +0000 (13:55 +0200)]
Tools: remove dependency on PVE::Cluster

by moving parse_sid to PVE::HA::Env, with the default implementation in
PVE::HA::Config.

the bash completion methods use PVE::HA::Config (and PVE::Cluster), but
the corresponding use statements are only in PVE::CLI::ha_manager, where the
bash completion is actually used.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 years agoTools/Config: refactor lrm status json reading
Fabian Grünbichler [Wed, 10 Oct 2018 11:55:03 +0000 (13:55 +0200)]
Tools/Config: refactor lrm status json reading

to avoid unnecessary dependency on PVE::Cluster in PVE::HA::Tools.

reading the LRM status file was the only instance of reading from the
CFS via this method.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 years agosim: don't install PVE::HA::Config
Fabian Grünbichler [Fri, 28 Sep 2018 10:48:54 +0000 (12:48 +0200)]
sim: don't install PVE::HA::Config

it is not needed anymore by the simulator.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 years agosim: don't install real resources
Fabian Grünbichler [Fri, 28 Sep 2018 10:48:53 +0000 (12:48 +0200)]
sim: don't install real resources

they are not needed, the simulator contains its own (simulated)
resources.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 years agogroups: register groups directly
Fabian Grünbichler [Fri, 28 Sep 2018 10:48:51 +0000 (12:48 +0200)]
groups: register groups directly

and use PVE::HA::Groups to parse the config when testing/simulating.

this allows us to drop the dependency on PVE::HA::Config, which would
otherwise pull in a lot of additional depdendencies that we don't want
in the simulator.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 years agopve-ha-tester: use correct lib path
Fabian Grünbichler [Fri, 28 Sep 2018 10:48:50 +0000 (12:48 +0200)]
pve-ha-tester: use correct lib path

since we want to test the version from the current working tree, and not
the installed one.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 years agoremove unused use statements
Fabian Grünbichler [Fri, 28 Sep 2018 10:48:49 +0000 (12:48 +0200)]
remove unused use statements

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 years agobuild: remove leftover PHONY declaration
Fabian Grünbichler [Fri, 28 Sep 2018 10:48:48 +0000 (12:48 +0200)]
build: remove leftover PHONY declaration

simdeb is already declared PHONY on its own

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 years agodocument api result for ha resources
Dominik Csapak [Mon, 17 Sep 2018 08:33:21 +0000 (10:33 +0200)]
document api result for ha resources

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
6 years agobump version to 2.0-5
Thomas Lamprecht [Wed, 7 Feb 2018 10:20:21 +0000 (11:20 +0100)]
bump version to 2.0-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agobuildsys: use correct git revision for SOURCE file
Thomas Lamprecht [Wed, 7 Feb 2018 09:32:27 +0000 (10:32 +0100)]
buildsys: use correct git revision for SOURCE file

6 years agodo not do active work if cfs update failed
Thomas Lamprecht [Wed, 22 Nov 2017 10:53:12 +0000 (11:53 +0100)]
do not do active work if cfs update failed

We ignored if the cluster state update failed and happily worked with
an empty state, resulting in strange actions, e.g., the removal of
all (not so) "stale" services or changing the all but the masters
node state to unknown.

Check on the update result and if failed, either do not get active,
or, if already active, skip the current round with the knowledge
that we only got here because the update failed but our lock renew
worked => cfs got already in a working and quorate state again -
(probably just a restart)

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>
6 years agomove cfs update to common code
Thomas Lamprecht [Wed, 22 Nov 2017 10:53:11 +0000 (11:53 +0100)]
move cfs update to common code

We updated the CRM and LRM view of the cluster state only in the PVE2
environment, outside of all regression testing and simulation scope.

Further, we ignored if this update failed and happily worked with an
empty state, resulting in strange actions, e.g., the removal of all
(not so) "stale" services or changing the all but the masters node
state to unknown.

This patch tries to improve this by moving out the update in a own
environment method, cluster_update_state, calling this in the LRM and
CRM and saving its result.
As with our introduced functionallity to simulate cfs rw or update
errors we can also simulate failures of this state update with the RT
system.

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>
6 years agomove start/end hooks to common code
Thomas Lamprecht [Wed, 22 Nov 2017 10:53:10 +0000 (11:53 +0100)]
move start/end hooks to common code

We called them at similar times anyways, and have them under the
regression test cover with this change.

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>
6 years agoRevert "wrap possible problematic cfs_read_file calls in eval"
Thomas Lamprecht [Wed, 22 Nov 2017 10:53:09 +0000 (11:53 +0100)]
Revert "wrap possible problematic cfs_read_file calls in eval"

This reverts commit bf7febe3771d6f9a2aef97bcd6eab4ece098c5aa.

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>
6 years agoCRM: refactor check if state transition to active is ok
Thomas Lamprecht [Wed, 22 Nov 2017 10:53:08 +0000 (11:53 +0100)]
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>
6 years agolrm: handle an error during service_status update
Thomas Lamprecht [Wed, 22 Nov 2017 10:53:07 +0000 (11:53 +0100)]
lrm: handle an error during service_status update

we may get an error here if the cluster filesystem is (temporarily)
unavailable here, this error resulted in stopping the whole CRM
service immediately, which then triggered a node reset (if happened
on the current master), even if we had still time left to retry and
thus, for example, handle a update of pve-cluster gracefully.

Add a method which wraps the status read in an eval and logs an
eventual error, but does not abort the service. Instead we rely on
our get_protected_ha_agent_lock method to detect a problem and switch
to the lost_agent_lock state.

If the pmxcfs outage was really short, so that the manager status
read failed but the lock update worked again we update also always
before doing real work when in the 'active' state. If this update
fails we return from the eval and try next round again, as no point
in doing anything without consistent state.

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>
6 years agotest/sim: allow to simulate cfs failures
Thomas Lamprecht [Wed, 22 Nov 2017 10:53:06 +0000 (11:53 +0100)]
test/sim: allow to simulate cfs failures

Add simulated hardware commands for the cluster file system.

This allows to tell the regression test or simulator system that a
certain nodes calls to methods accessing the CFS should fail, i.e.,
die.
With this we can cover a situation which mainly happen during a
cluster file system update.

For now allow to define if the CFS is read-/writeable (state rw) and
if updates of the CFS (state update) should work or fail.

Add 'can read/write' assertions all over the relevant methods.

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>
6 years agopostinst: use auto generated postinst
Thomas Lamprecht [Wed, 24 Jan 2018 10:04:56 +0000 (11:04 +0100)]
postinst: use auto generated postinst

This was introduced for cleaning up an possible left over systemd
watchdog mux enable link, which is gone for good now.

Then it was extended with trigger targets, as the HA Manager services
now restart when the pve-api-update trigger fires.
As the autogenerated postinst does the same unconditionally for the
pve-ha-lrm.service and pve-ha-crm.service already we may remove it
too.
The only difference is that try-restart is used by the auto generated
script, not reload-or-try-restart, but this does not matter, as the
HA services have currently no reload ability.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agopostinst: we do not use templates, remove debconf
Thomas Lamprecht [Wed, 24 Jan 2018 10:04:55 +0000 (11:04 +0100)]
postinst: we do not use templates, remove debconf

This was copied by accident when adding the transitional code for
removing the left over of the systemd managed watchdog mux in
commit f8a3fc80af299e613c21c9b67e29aee8cc807018

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agopostinst: drop transitional systemd watchdog mux socket cleanup
Thomas Lamprecht [Wed, 24 Jan 2018 10:04:54 +0000 (11:04 +0100)]
postinst: drop transitional systemd watchdog mux socket cleanup

This transitional code was added first with
commit f8a3fc80af299e613c21c9b67e29aee8cc807018
and fixed up with
commit ecc145c9724f056549e5458f17d7714ac8c83459
during Proxmox VE 4.1 and 4.2 to remove the problematic systemd
managed watchdog mux socket.

As each system going for an distribution upgrade must first upgrade
to 4.4, where this gets handled, we can remove it now.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agowatchdog mux: trailing whitespace cleanup
Thomas Lamprecht [Tue, 16 Jan 2018 08:08:38 +0000 (09:08 +0100)]
watchdog mux: trailing whitespace cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agowatchdog mux: fix comment, there's no systemd .socket anymore
Thomas Lamprecht [Tue, 16 Jan 2018 08:03:26 +0000 (09:03 +0100)]
watchdog mux: fix comment, there's no systemd .socket anymore

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agofix typo in simulator package description
Thomas Lamprecht [Mon, 15 Jan 2018 11:39:30 +0000 (12:39 +0100)]
fix typo in simulator package description

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agodebian/rules: add some explaining comments
Fabian Grünbichler [Wed, 20 Dec 2017 10:34:03 +0000 (11:34 +0100)]
debian/rules: add some explaining comments

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agodebian/rules: don't dh_systemd_start watchdog-mux
Fabian Grünbichler [Wed, 20 Dec 2017 10:34:02 +0000 (11:34 +0100)]
debian/rules: don't dh_systemd_start watchdog-mux

as it's a static unit dh_systemd_starting it is not possible - but it gets
pulled in and started by pve-ha-crm/pve-ha-lrm anyway.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agodebian/rules: add file names to dh_systemd_enable
Fabian Grünbichler [Wed, 20 Dec 2017 10:34:01 +0000 (11:34 +0100)]
debian/rules: add file names to dh_systemd_enable

otherwise it gets confused and enables pve-ha-crm twice in the postinst.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agobuildsys: also cleanup *.buildinfo files
Thomas Lamprecht [Tue, 7 Nov 2017 14:29:01 +0000 (15:29 +0100)]
buildsys: also cleanup *.buildinfo files

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agobump version to 2.0-4
Wolfgang Bumiller [Thu, 9 Nov 2017 10:47:36 +0000 (11:47 +0100)]
bump version to 2.0-4

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
6 years agowrap possible problematic cfs_read_file calls in eval
Thomas Lamprecht [Wed, 8 Nov 2017 13:41:40 +0000 (14:41 +0100)]
wrap possible problematic cfs_read_file calls in eval

Wrap those calls to the cfs_read_file method, which may now also die
if there was a grave problem reading the file, into eval in all
methods which are used by the ha services.

The ones only used by API calls or CLI helpers are not wrapped, as
there it can be handled more gracefull (i.e., no watchdog is
running) and further, this is more intended to temporarily workaround
until we handle such an exception explicitly in the services - which
is a bit bigger change, so let's just go back to the old behavior for
now.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agoswap native syslog command with HA environment one
Thomas Lamprecht [Tue, 7 Nov 2017 14:27:08 +0000 (15:27 +0100)]
swap native syslog command with HA environment one

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agoUse run_cli_handler instead of deprecated run_cli
Philip Abernethy [Mon, 16 Oct 2017 08:59:24 +0000 (10:59 +0200)]
Use run_cli_handler instead of deprecated run_cli

6 years agobuild: add simulator to deb target
Fabian Grünbichler [Fri, 13 Oct 2017 09:26:00 +0000 (11:26 +0200)]
build: add simulator to deb target

6 years agobump version to 2.0-3
Fabian Grünbichler [Fri, 13 Oct 2017 09:12:21 +0000 (11:12 +0200)]
bump version to 2.0-3

6 years agodo not show a service as queued if not configured
Thomas Lamprecht [Tue, 24 Jan 2017 17:37:23 +0000 (18:37 +0100)]
do not show a service as queued if not configured

The check if a service is configured has precedence over the check if
a service is already processed by the manager.
This fixes a bug where a service could be shown as queued even if he
was meant to be ignored.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agoadd ignore state for resources
Thomas Lamprecht [Tue, 24 Jan 2017 17:37:22 +0000 (18:37 +0100)]
add ignore state for resources

In this state the resource will not get touched by us, all commands
(like start/stop/migrate) go directly to the VM/CT itself and not
through the HA stack.
The resource will not get recovered if its node fails.

Achieve that by simply removing the respective service from the
manager_status service status hash if it is in ignored state.

Add the state also to the test and simulator hardware.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agoclean up 'Data::Dumper' usage tree wide
Thomas Lamprecht [Wed, 11 Oct 2017 13:10:20 +0000 (15:10 +0200)]
clean up 'Data::Dumper' usage tree wide

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agolrm: crm: show interest in pve-api-update trigger
Thomas Lamprecht [Wed, 11 Oct 2017 13:10:19 +0000 (15:10 +0200)]
lrm: crm: show interest in pve-api-update trigger

To ensure that the LRM and CRM services get reloaded when
pve-api-update trigger gets activated.
Important, as we directly use perl API modules from qemu-server,
pve-container, pve-common and really want to avoid to run outdated,
possible problematic or deprecated, code.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agolrm.service: do not timeout on stop
Thomas Lamprecht [Wed, 11 Oct 2017 13:10:18 +0000 (15:10 +0200)]
lrm.service: do not timeout on stop

we must shut all services down when stopping the LRM for a host
shutdown, this can take longer than 95 seconds and should not
get interrupted to ensure a gracefull poweroff.

The watchdog is still active untill all services got stopped so we
still are safe from a freeze or equivalent failure.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agobuild: reformat debian/control
Fabian Grünbichler [Wed, 4 Oct 2017 09:05:33 +0000 (11:05 +0200)]
build: reformat debian/control

using wrap-and-sort -abt

6 years agofix #1347: let postfix fill in FQDN in fence mails
Philip Abernethy [Thu, 14 Sep 2017 12:39:33 +0000 (14:39 +0200)]
fix #1347: let postfix fill in FQDN in fence mails

Using the nodename in $mailto is not correct and can lead to mails not
forwarding in restrictive mail server configurations.
Also changes $mailfrom to 'root' instead of 'root@localhost', which
results in postfix appending the proper FQDN there, too. As a result the
Delivered-to header reads something like 'root@host.domain.tld' instead
of 'root@localhost', which is much more informational and more
consistent.

Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agofix #1073: do not count backup-suspended VMs as running
Thomas Lamprecht [Wed, 23 Aug 2017 08:15:49 +0000 (10:15 +0200)]
fix #1073: do not count backup-suspended VMs as running

when a stopped VM managed by HA got backuped the HA stack
continuously tried to shut it down as check_running returns only if a
PID for the VM exists.
As the VM was locked the shutdown tries were blocked, but still a lot
of annoying messages and task spawns happened during the backup
period.

As querying the VM status through the vm monitor is not cheap, check
if the VM is locked with the backup lock first, the config is cached
and so this is quite cheap, only then query the VMs status over qmp,
and check if the VM is in the 'prelaunch' state.
This state gets only set if KVM was started with the `-S` option and
has not yet continued guest operation.

Some performance results, I repeated each check 1000 times, first
number is the total time spent just with the check, second time is
the the time per single check:

old check (vm runs):            87.117 ms/total =>  87.117 us/loop
new check (runs, no backup):   107.744 ms/total => 107.744 us/loop
new check (runs, backup):      760.337 ms/total => 760.337 us/loop

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agobump version to 2.0-2
Dietmar Maurer [Wed, 14 Jun 2017 05:51:20 +0000 (07:51 +0200)]
bump version to 2.0-2

6 years agoexplicitly sync journal when disabling watchdog updates
Thomas Lamprecht [Tue, 23 May 2017 12:35:38 +0000 (14:35 +0200)]
explicitly sync journal when disabling watchdog updates

Without syncing the journal could loose logs for a small interval (ca
10-60 seconds), but these last seconds are really interesting for
analyzing the cause of a triggered watchdog.

Also without this often the
> "client did not stop watchdog - disable watchdog updates"
messages wasn't flushed to persistent storage and so some users had a
hard time to figure out why the machine reset.

Use the '--sync' switch of journalctl which - to quote its man page -
"guarantees that any log messages written before its invocation are
safely stored on disk at the time it returns."

Use execl to call `journalctl --sync` in a child process, do not care
for any error checks or recovery as we will be reset anyway. This is
just a hit or miss try to log the situation more consistently, if it
fails we cannot really do anything anyhow.

We call the function on two points:
a) if we exit with active connections, here the watchdog will be
   triggered soon and we want to ensure that this is logged.
b) if a client closes the connection without sending the magic close
   byte, here the watchdog would trigger while we hang in epoll at
   the beginning of the loop, so sync the log here also.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agoalways queue service stop if node shuts down
Thomas Lamprecht [Fri, 26 May 2017 15:56:11 +0000 (17:56 +0200)]
always queue service stop if node shuts down

Commit 61ae38eb6fc5ab351fb61f2323776819e20538b7 which ensured that
services get freezed on a node reboot had a side effect where running
services did not get gracefully shutdown on node reboot.
This may lead to data loss as the services then get hard killed, or
they may even prevent a node reboot because a storage cannot get
unmounted as a service still access it.

This commits addresses this issue but does not changes behavior of
the freeze logic for now, but we should evaluate if a freeze makes
really sense here or at least make it configurable.

The changed regression test is a result of the fact that we did not
adapt the correct behavior for the is_node_shutdown command in the
problematic commit. The simulation envrionment returned true
everytime a node shutdown (reboot and poweroff) and the real world
environment just returned true if a poweroff happened but not on a
reboot.

Now the simulation acts the same way as the real environment.
Further I moved the simulation implemenentation to the base class so
that both simulator and regression test system behave the same.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 years agoFix shutdown order of HA and storage services
Wolfgang Link [Thu, 27 Apr 2017 10:02:35 +0000 (12:02 +0200)]
Fix shutdown order of HA and storage services

It is important that all storages stop after pve-ha-lrm.

If the storages stop too early the vm loses disks and can not shutdown.

This can end in fencing the node.

7 years agoResource/API: abort early if resource in error state
Thomas Lamprecht [Tue, 24 Jan 2017 16:54:03 +0000 (17:54 +0100)]
Resource/API: abort early if resource in error state

If a service is in error state the single state change command that
can make sense is setting the disabled request state.
Thus abort on all other commands early to enhance user experience.

7 years agobump version to 2.0-1
Fabian Grünbichler [Mon, 13 Mar 2017 10:32:16 +0000 (11:32 +0100)]
bump version to 2.0-1

7 years agobuildsys: update make upload target for stretch
Fabian Grünbichler [Mon, 13 Mar 2017 10:32:09 +0000 (11:32 +0100)]
buildsys: update make upload target for stretch

7 years agobuildsys: don't pull qemu/lxc during doc-generation
Wolfgang Bumiller [Mon, 6 Feb 2017 15:10:07 +0000 (16:10 +0100)]
buildsys: don't pull qemu/lxc during doc-generation

7 years agobuildsys: make job safety
Wolfgang Bumiller [Mon, 6 Feb 2017 14:32:34 +0000 (15:32 +0100)]
buildsys: make job safety

7 years agobuildsys: drop libsystemd-daemon-dev build dep
Wolfgang Bumiller [Mon, 6 Feb 2017 14:20:09 +0000 (15:20 +0100)]
buildsys: drop libsystemd-daemon-dev build dep

We don't actually need it and it and on stretch
libsystemd-dev (which we still depend on) replaces it.

7 years agobump version to 1.0-40
Dietmar Maurer [Tue, 24 Jan 2017 09:03:27 +0000 (10:03 +0100)]
bump version to 1.0-40

7 years agosim: allow adding service on runtime
Thomas Lamprecht [Thu, 19 Jan 2017 12:32:50 +0000 (13:32 +0100)]
sim: allow adding service on runtime

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 years agosim: factor out service gui entry addition
Thomas Lamprecht [Thu, 19 Jan 2017 12:32:49 +0000 (13:32 +0100)]
sim: factor out service gui entry addition

Will be used to allow adding services to the simulator on runtime in
a future patch.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 years agosim: allow deleting service via GUI
Thomas Lamprecht [Thu, 19 Jan 2017 12:32:48 +0000 (13:32 +0100)]
sim: allow deleting service via GUI

Add a delete button to each service entry row. This allows deleting a
service on runtime.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 years agosim: allow new service request states over gui
Thomas Lamprecht [Thu, 19 Jan 2017 12:32:47 +0000 (13:32 +0100)]
sim: allow new service request states over gui

Change the old enabled/disabled GTK "Switch" element to a ComboBox
one and add all possible service states, so we can simulate the real
world behaviour with its new states better.

As we do not need to map a the boolean swicth value to our states
anymore, we may drop the set_setvice_state method from the RTHardware
class and use the one from the Hardware base class instead.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 years agofactor out and unify sim_hardware_cmd
Thomas Lamprecht [Thu, 19 Jan 2017 12:32:46 +0000 (13:32 +0100)]
factor out and unify sim_hardware_cmd

Most things done by sim_hardware_cmd are already abstracted and
available in both, the TestHardware and the RTHardware class.

Abstract out the CRM and LRM control to allow the unification of both
classes sim_hardware_cmd.

As in the last year mostly the regression test systems TestHardware
class saw new features use it as base.

We return now the current status out of the locked context, this
allows to update the simulators GUI out of the locked context.

This changes increases the power of the HA Simulator, but the new
possible actions must be still implemented in its GUI. This will be
done in future patches.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 years agosim: allocate HA Env only once per service and node
Thomas Lamprecht [Thu, 19 Jan 2017 12:32:45 +0000 (13:32 +0100)]
sim: allocate HA Env only once per service and node

Do not allocate the HA Environment every time we fork a new CRM or
LRM, but once at the start of the Simulator for all nodes.
This can be done as the Env does not saves any state and thus can be
reused, we use this also in the TestHardware class.
Making the behavior of both Hardware classes more similar allows us
to refactor out some common code in following commits.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 years agoStatus: factor out new service state calculation
Thomas Lamprecht [Thu, 12 Jan 2017 14:51:59 +0000 (15:51 +0100)]
Status: factor out new service state calculation

Factor out the new "fast feedback for user" service state calculation
and use it also in the HA Simulator to provide the same feedback as
in the real world.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 years agosim: show current master node more prominent
Thomas Lamprecht [Thu, 12 Jan 2017 14:51:58 +0000 (15:51 +0100)]
sim: show current master node more prominent

just upercasing the node status if it is the current master is not
really intuitive

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>