]> git.proxmox.com Git - pve-ha-manager.git/log
pve-ha-manager.git
8 years agoFix postinstall script not removing watchdog-mux.socket
Wolfgang Bumiller [Thu, 4 Feb 2016 09:49:53 +0000 (10:49 +0100)]
Fix postinstall script not removing watchdog-mux.socket

watchdog-mux.socket was removed in f8a3fc80af but the
postinstall script used -e instead of -L to test for the
symlink, which fails since the destination is already
removed at that point.

Use -L and remove the dead symlink if it exists.

Reported-by: Alexandre Derumier <aderumier@odiso.com>
8 years agobump versionm to 1.0-20
Dietmar Maurer [Wed, 27 Jan 2016 16:05:46 +0000 (17:05 +0100)]
bump versionm to 1.0-20

8 years agomove upid_wait from PVE2 env to HA::Tools
Thomas Lamprecht [Wed, 27 Jan 2016 12:16:35 +0000 (13:16 +0100)]
move upid_wait from PVE2 env to HA::Tools

We can now use the new wait_upid from PVE::Tools and we output a
"Task still active" every five seconds instead of every second,
so we trash the log less.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agofix check if a resource migrated correctly
Thomas Lamprecht [Wed, 27 Jan 2016 12:16:34 +0000 (13:16 +0100)]
fix check if a resource migrated correctly

Move the check from exec_resource_agents to the migrate method of
the resource plugins so that we may delete the traces from the
additional method 'is_on_node' which was intended for this
purpose.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoadd after_fork method to HA environment and use it in LRM
Thomas Lamprecht [Wed, 27 Jan 2016 12:16:33 +0000 (13:16 +0100)]
add after_fork method to HA environment and use it in LRM

As both the realtime simulator and the real world Environment can
fork but we only need to clean up after a fork in the real world
introduce a after_fork method

In PVE2 it closes the inherited INotify fd and reopens it for the
worker.
Also a cfs_update gets triggered as (other) workers may change the
cluster state.

also use the new introduction HA-Env method to clean up after
we forked an LRM worker.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agochange include order to register resource plugin correctly
Dietmar Maurer [Wed, 27 Jan 2016 07:24:11 +0000 (08:24 +0100)]
change include order to register resource plugin correctly

8 years agoremove ugly import hack
Dietmar Maurer [Tue, 26 Jan 2016 16:12:52 +0000 (17:12 +0100)]
remove ugly import hack

Not required if we register resources from the Env class.

8 years agouse require to include resources from simulation environment
Dietmar Maurer [Tue, 26 Jan 2016 11:47:28 +0000 (12:47 +0100)]
use require to include resources from simulation environment

Because the may not be installed on a normal system.

8 years agoMove exec_resource_agent from environment classes to LRM
Thomas Lamprecht [Fri, 22 Jan 2016 16:06:42 +0000 (17:06 +0100)]
Move exec_resource_agent from environment classes to LRM

With the changes and preparation work from the previous commits
we can now move the quite important method exec_resource_agent
from the Env classes to the LRM where it get's called.

The main advantage of this is that it now underlies regression
tests and that we do not have two separate methods where it
- does not make sense as agents them self should be virtualized
  not the method executing them
- adds more work as the must (or at least should) be in sync

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoPVE::HA::Config: use import flag to load appropritate resources
Dietmar Maurer [Tue, 26 Jan 2016 08:23:54 +0000 (09:23 +0100)]
PVE::HA::Config: use import flag to load appropritate resources

8 years agoAdd virtual resources for tests and simulation
Thomas Lamprecht [Fri, 22 Jan 2016 16:06:39 +0000 (17:06 +0100)]
Add virtual resources for tests and simulation

Introduce a base class for Virtual Resources with almost all methods
already implemented.
Also add a class for virtual CTs and VMs, with the primary
distinction that CTs may not migrate online.

The Resource are registered in the Hardware class and overwrite
any already registered resources from the same type (e.g. VirtVM
overwrites PVEVM) so that the correct plugins are loaded for
regression tests and the simulator.

This makes the way free for adding(deterministic) 'malicious'
resources, so we can make test where, for example, a service fails
a few times to start or migrate.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoEnv: add method to get hardware object
Thomas Lamprecht [Fri, 22 Jan 2016 16:06:37 +0000 (17:06 +0100)]
Env: add method to get hardware object

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoadd 'haenv' parameter to plugin method 'check_running'
Thomas Lamprecht [Fri, 22 Jan 2016 16:06:38 +0000 (17:06 +0100)]
add 'haenv' parameter to plugin method 'check_running'

This is preparation work and needed when adding virtual resources
for testing/simulation purpose.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoSplit up resources and move them to own sub folder
Thomas Lamprecht [Fri, 22 Jan 2016 16:06:35 +0000 (17:06 +0100)]
Split up resources and move them to own sub folder

Implementing every resource in the base 'Resources' class is a bit
messy, especially if more resource agent get added.

This moves each class to a own Perl module in the new 'Resources'
sub folder.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoLRM: do not release lock on shutdown errors
Thomas Lamprecht [Mon, 18 Jan 2016 12:50:28 +0000 (13:50 +0100)]
LRM: do not release lock on shutdown errors

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agobump version to 1.0-19
Dietmar Maurer [Mon, 18 Jan 2016 11:41:30 +0000 (12:41 +0100)]
bump version to 1.0-19

8 years agoremove 'running' from migrate/relocate log message
Thomas Lamprecht [Mon, 18 Jan 2016 10:35:21 +0000 (11:35 +0100)]
remove 'running' from migrate/relocate log message

As relocate is never 'running' and migrate is only 'running
if the resource is a VM this could only generate confusion,
better use an neutral message.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoLRM: release lock also on restart
Thomas Lamprecht [Mon, 18 Jan 2016 10:35:20 +0000 (11:35 +0100)]
LRM: release lock also on restart

Wen restarting the LRM (e.g. on a update) we get an new pid and thus
have to wait for our own lock to timeout.
We can (and should) do that as there are no services or all services
are freezed. If they are freezed only our LRM may touch them so we
we can unfreeze them faster with this patch.

The expected log of the restart-lrm test does not change much as the
test system does not need to wait for a timeout.

This let's the LRM start working directly after a restart,
especially usefull on package updates.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoTestHardware: correct shutdown/reboot behaviour of CRM and LRM
Thomas Lamprecht [Mon, 18 Jan 2016 09:26:45 +0000 (10:26 +0100)]
TestHardware: correct shutdown/reboot behaviour of CRM and LRM

Instead of shutting down the LRM and then killing the CRM we now
also make a shutdown request to the CRM, that mirrors the real world
behaviour much better and let's us also test the lock release from
the CRM.

To accomplish this we add new sim_hardware commands for stopping and
starting the CRM.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agorelease LRM agent lock on graceful shutdown
Thomas Lamprecht [Fri, 15 Jan 2016 07:27:35 +0000 (08:27 +0100)]
release LRM agent lock on graceful shutdown

Release the agent lock when we shutdown the LRM and stopped all
services.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoCRM: release lock on shutdown request
Thomas Lamprecht [Wed, 13 Jan 2016 14:15:32 +0000 (15:15 +0100)]
CRM: release lock on shutdown request

release the manager lock on a shutdown request, so another CRM slave
can get it and continue to work without waiting for the lock timeout

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoresource agents: fix relocate
Thomas Lamprecht [Wed, 13 Jan 2016 14:15:31 +0000 (15:15 +0100)]
resource agents: fix relocate

Previously a relocate from a running VM wasn't possible as we always
tried to migrate online, this patch fixes that.

Also only VMs may migrate online for now Container will always get relocated.

This avoids also confusion from the 'migrate (running)' log message
in case of CTs as the always get relocated.

Fixes test test-shutdown3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoresource agents: generate parameters inside resource classes
Thomas Lamprecht [Wed, 13 Jan 2016 14:15:30 +0000 (15:15 +0100)]
resource agents: generate parameters inside resource classes

The params of resource methods are normally specific for each
resource type.

CTs and VMs have the same interfaces in the needed cases so we could
generate the params in the exec_resource_agent method. This is not
clean because:
 * resource specific stuff shouldn't be in this method
 * this can make problems if we want to add another resource type
   in the future which has a completely different interface

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoadd test for container failback
Dietmar Maurer [Wed, 13 Jan 2016 08:04:01 +0000 (09:04 +0100)]
add test for container failback

8 years agoallow to simulate container resources
Dietmar Maurer [Wed, 13 Jan 2016 07:42:25 +0000 (08:42 +0100)]
allow to simulate container resources

8 years agoconvert agent restult to exit code
Dietmar Maurer [Wed, 13 Jan 2016 07:40:20 +0000 (08:40 +0100)]
convert agent restult to exit code

8 years agoadd another test case for failback
Dietmar Maurer [Wed, 13 Jan 2016 06:44:04 +0000 (07:44 +0100)]
add another test case for failback

8 years agobump version to 1.0-18
Dietmar Maurer [Tue, 12 Jan 2016 11:28:18 +0000 (12:28 +0100)]
bump version to 1.0-18

8 years agopve-ha-lrm.service: depend on lxc.service
Dietmar Maurer [Tue, 12 Jan 2016 11:02:23 +0000 (12:02 +0100)]
pve-ha-lrm.service: depend on lxc.service

lxc.service kills all containers at shutdown. So we need to deppend
on that, so that we can cleanly shutdown our containers.

8 years agore-add #DEBHELPER# code to postinst
Dietmar Maurer [Tue, 12 Jan 2016 09:37:50 +0000 (10:37 +0100)]
re-add #DEBHELPER# code to postinst

otherwise the services are not re-started correctly!

8 years agocleanup postinst script
Dietmar Maurer [Tue, 12 Jan 2016 09:29:21 +0000 (10:29 +0100)]
cleanup postinst script

only remove files when necessary - and run systemctl daemon-reload.

8 years agofree cmd pointer after it's execution
Thomas Lamprecht [Mon, 11 Jan 2016 12:20:17 +0000 (13:20 +0100)]
free cmd pointer after it's execution

Quoting the asprintf man page:
> [..]
> This pointer should be passed to free(3) to release the allocated
> storage when it is  no  longer needed.
> [..]

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agooutput watchdog module name if it gets loaded
Thomas Lamprecht [Mon, 11 Jan 2016 12:20:16 +0000 (13:20 +0100)]
output watchdog module name if it gets loaded

If /dev/watchdog is not present and a WATCHDOG_MODULE env variable
is set, output it's name before trying to load it (helps debugging).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agosmall cleanup
Thomas Lamprecht [Mon, 11 Jan 2016 12:20:15 +0000 (13:20 +0100)]
small cleanup

remove the unlink_socket variable and it's check as they wher
always true, as error and the end of the programm can only be
reached when the socket is already set up.
Also unlinking an non existent file does not result in any error.

also some whitespace cleanup in the surrounding area.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoremove watchdog-mux.socket
Thomas Lamprecht [Mon, 11 Jan 2016 12:20:14 +0000 (13:20 +0100)]
remove watchdog-mux.socket

The use of an systemd socket unit for the watchdog socket is not
necessary for us it even generates problems as the socket already
runs and accepts input when the watchdog-mux daemon itself is not
running. So the LRM/CRM could successfully open and update the
watchdog even if it was not running!

This patch removes the unit file, adds a postinst script which
handles the removal of the links generated from systemd itself
and removes also the code from watchdog-mux which handled
the systemd socket unit.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agobump version to 1.0-17
Dietmar Maurer [Mon, 11 Jan 2016 11:25:58 +0000 (12:25 +0100)]
bump version to 1.0-17

8 years agoResources.pm: use PVE::API2::LXC
Dietmar Maurer [Mon, 11 Jan 2016 11:24:02 +0000 (12:24 +0100)]
Resources.pm: use PVE::API2::LXC

8 years agoimprove log messages if service stop fails.
Dietmar Maurer [Fri, 8 Jan 2016 10:24:11 +0000 (11:24 +0100)]
improve log messages if service stop fails.

8 years agoadd service addition and deletion regression tests
Thomas Lamprecht [Thu, 7 Jan 2016 10:34:50 +0000 (11:34 +0100)]
add service addition and deletion regression tests

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoadd service relocate regression test
Thomas Lamprecht [Thu, 7 Jan 2016 10:34:49 +0000 (11:34 +0100)]
add service relocate regression test

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoSim/Env: fix removing service from old node on migration
Thomas Lamprecht [Tue, 22 Dec 2015 07:52:38 +0000 (08:52 +0100)]
Sim/Env: fix removing service from old node on migration

We only removed the service from the source node on a relocate, we
also want to remove it on a successfull migration else we have it
on two nodes at the same time.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoadd test to for previous commit
Thomas Lamprecht [Tue, 22 Dec 2015 07:52:39 +0000 (08:52 +0100)]
add test to for previous commit

This shows why we need always to 'delete' (i.e. setting it to 0)
the service from the old node when relocating or migrating.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoadd service migrate/relocate to regression tests
Thomas Lamprecht [Tue, 22 Dec 2015 07:52:37 +0000 (08:52 +0100)]
add service migrate/relocate to regression tests

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoadd queue_crm_commands_nolock
Dietmar Maurer [Tue, 22 Dec 2015 08:47:30 +0000 (09:47 +0100)]
add queue_crm_commands_nolock

8 years agoadd service disable/enable to regression tests
Thomas Lamprecht [Tue, 22 Dec 2015 07:52:35 +0000 (08:52 +0100)]
add service disable/enable to regression tests

Allow execution of user triggered service commands in regression
tests, like enable or disable. This is the test equivalent to a
ha-manager action service:id
command.

Also add a test for a disable enable cycle.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoSim/Hardware: move set_service_state to base class
Thomas Lamprecht [Tue, 22 Dec 2015 07:52:33 +0000 (08:52 +0100)]
Sim/Hardware: move set_service_state to base class

Move the set_service_state method from the Realtime Hardware class
(RTHardware) to it's base class as the TestHardware could also use
it.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoTestHardware: use more informative error message
Thomas Lamprecht [Mon, 21 Dec 2015 11:52:54 +0000 (12:52 +0100)]
TestHardware: use more informative error message

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agobump version to 1.0-16
Dietmar Maurer [Mon, 21 Dec 2015 09:21:46 +0000 (10:21 +0100)]
bump version to 1.0-16

8 years agocheck_active_workers: fix typo /uuid/uid/
Thomas Lamprecht [Mon, 21 Dec 2015 09:12:47 +0000 (10:12 +0100)]
check_active_workers: fix typo /uuid/uid/

This typo caused a bug where resource_command_finished was never
called as $w->{uuid} is not existing and thus always undefined.
Use the correct $w->{uid} instead.

Also fix a comment where used 'uuid' to avoid confusion.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoavoid warning about uninitialized value
Dietmar Maurer [Wed, 16 Dec 2015 09:38:27 +0000 (10:38 +0100)]
avoid warning about uninitialized value

8 years agobump version to 1.0-15
Dietmar Maurer [Wed, 16 Dec 2015 09:34:22 +0000 (10:34 +0100)]
bump version to 1.0-15

8 years agocorrectly stop all resources on shutdown
Dietmar Maurer [Wed, 16 Dec 2015 09:30:37 +0000 (10:30 +0100)]
correctly stop all resources on shutdown

And wait for all worker tasks before exit.

8 years agolrm: catch repeated calls to shutdown_request
Dietmar Maurer [Wed, 16 Dec 2015 08:32:46 +0000 (09:32 +0100)]
lrm: catch repeated calls to shutdown_request

8 years agoimplement restart-lrm test
Dietmar Maurer [Wed, 16 Dec 2015 07:37:16 +0000 (08:37 +0100)]
implement restart-lrm test

8 years agonew test for node shutdown
Dietmar Maurer [Wed, 16 Dec 2015 07:21:21 +0000 (08:21 +0100)]
new test for node shutdown

8 years agocorrectly reset node status on power on/off
Dietmar Maurer [Wed, 16 Dec 2015 07:14:07 +0000 (08:14 +0100)]
correctly reset node status on power on/off

8 years agolrm: only freeze services if lrm is in 'restart' mode
Dietmar Maurer [Wed, 16 Dec 2015 06:41:39 +0000 (07:41 +0100)]
lrm: only freeze services if lrm is in 'restart' mode

8 years agorename is_poweroff to is_node_shutdown
Dietmar Maurer [Wed, 16 Dec 2015 05:46:34 +0000 (06:46 +0100)]
rename is_poweroff to is_node_shutdown

8 years agolrm: implement different behavior for shutdown and restart
Dietmar Maurer [Wed, 16 Dec 2015 05:31:56 +0000 (06:31 +0100)]
lrm: implement different behavior for shutdown and restart

We want to keep resources running at service restart (freeze), but
want to stop them at them at shutdown.

Actual stoping service will follow in the next patch.

8 years agoHA Env: add 'is_poweroff' function
Thomas Lamprecht [Mon, 14 Dec 2015 14:29:59 +0000 (15:29 +0100)]
HA Env: add 'is_poweroff' function

This function returns true if we do an shutdown/poweroff and thus the
services should not get freezed but fenced if the node does not
comes back up fast enough.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
8 years agoTestHardware: add 'reboot' and 'shutdown' command
Dietmar Maurer [Tue, 15 Dec 2015 09:26:35 +0000 (10:26 +0100)]
TestHardware: add 'reboot' and 'shutdown' command

8 years agoHardware: remove unnecessary lock in get_node_info
Thomas Lamprecht [Mon, 14 Dec 2015 14:29:53 +0000 (15:29 +0100)]
Hardware: remove unnecessary lock in get_node_info

This lock is not needed asthe status gets written with
file_set_contents from PVE::Tools which is atomic (fuse bug does
not apply here) so we do not need to be scared that we read
inconsistent data.

This also prevents a deadlock if any function needs to know if the
simulated node is quorate in a locked context, like
sim_hardware_cmd is.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoset RELEASE=4.1
Dietmar Maurer [Thu, 3 Dec 2015 10:15:20 +0000 (11:15 +0100)]
set RELEASE=4.1

8 years agobump version to 1.0-14
Dietmar Maurer [Thu, 3 Dec 2015 10:10:04 +0000 (11:10 +0100)]
bump version to 1.0-14

8 years agoallow to configure watchdog module in /etc/default/pve-ha-manager
Dietmar Maurer [Thu, 3 Dec 2015 10:07:39 +0000 (11:07 +0100)]
allow to configure watchdog module in /etc/default/pve-ha-manager

All watchdog modules are blacklisted, so we cannot load them via /etc/modules.
Instead, watchdog-mux loads it at startup.

8 years agobump version to 1.0-13
Dietmar Maurer [Fri, 30 Oct 2015 10:17:09 +0000 (11:17 +0100)]
bump version to 1.0-13

8 years agoHA API: Fix permissions
Thomas Lamprecht [Fri, 30 Oct 2015 09:55:44 +0000 (10:55 +0100)]
HA API: Fix permissions

Integrate permission in the HA API so that not only root may do
changes.
-) create/edit/update actions need the 'Sys.Console' privileges on
   the root (/) path
-) read actions need the 'Sys.Audit' privilege on the root (/) path

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agobump version to 1.0-12
Dietmar Maurer [Thu, 29 Oct 2015 09:22:03 +0000 (10:22 +0100)]
bump version to 1.0-12

8 years agorefactor and reuse code in vm_is_ha_managed and service_is_ha_managed
Dietmar Maurer [Thu, 29 Oct 2015 09:19:14 +0000 (10:19 +0100)]
refactor and reuse code in vm_is_ha_managed and service_is_ha_managed

8 years agoexec_resource_agent: return valid exit code instead of die's
Thomas Lamprecht [Fri, 23 Oct 2015 12:04:25 +0000 (14:04 +0200)]
exec_resource_agent: return valid exit code instead of die's

Switch from die's to logging and return the respective exit codes.
This adds the possibility to handle (i.e.: fix) some errors outside
of the forked exec_resource_agent worker.

This does not changes behaviour for now, as the die returned an 255
exit code. We didn't checked on that exit code explicitly and so we
are safe to use the new exit codes, it results in the same behaviour
for the other code (most important the CRM Manager class).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoUse new exitcodes instead of integers
Thomas Lamprecht [Fri, 23 Oct 2015 12:04:24 +0000 (14:04 +0200)]
Use new exitcodes instead of integers

Use the new exitcodes introduced in the previous commit to gain
some readability.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoAdding constants to gain more readability
Thomas Lamprecht [Fri, 23 Oct 2015 12:04:23 +0000 (14:04 +0200)]
Adding constants to gain more readability

Add constants to make some code easier to understand, especially the
execution of resource agents and their return codes.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agobump version to 1.0-11
Dietmar Maurer [Wed, 21 Oct 2015 06:59:07 +0000 (08:59 +0200)]
bump version to 1.0-11

8 years agoadd workaround for bug #775
Dietmar Maurer [Wed, 21 Oct 2015 06:57:30 +0000 (08:57 +0200)]
add workaround for bug #775

8 years agobump version to 1.0-10
Dietmar Maurer [Mon, 12 Oct 2015 16:26:52 +0000 (18:26 +0200)]
bump version to 1.0-10

8 years agofix typo in error message s/storage/resource/
Thomas Lamprecht [Mon, 12 Oct 2015 13:04:42 +0000 (15:04 +0200)]
fix typo in error message s/storage/resource/

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agocheck resource better on addition and update
Thomas Lamprecht [Mon, 12 Oct 2015 13:04:41 +0000 (15:04 +0200)]
check resource better on addition and update

Check if the resource exists in the cluster when adding it to the
ha stack.
When trying to update/migrate or delete a resource check if it's
ha managed at all.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoAdd resource existence check helper
Thomas Lamprecht [Mon, 12 Oct 2015 13:04:40 +0000 (15:04 +0200)]
Add resource existence check helper

Add a helper to the resource class which returns service specific if
the resource exists on the cluster, i.e. can be added.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoDocument parameters in parent class
Thomas Lamprecht [Mon, 12 Oct 2015 13:04:39 +0000 (15:04 +0200)]
Document parameters in parent class

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoAdd 'service is ha managed' check
Thomas Lamprecht [Mon, 12 Oct 2015 13:04:38 +0000 (15:04 +0200)]
Add 'service is ha managed' check

add a check for a given $sid if it's managed by the ha stack

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agobump version to 1.0-9
Dietmar Maurer [Tue, 29 Sep 2015 05:35:56 +0000 (07:35 +0200)]
bump version to 1.0-9

8 years agodelete node from HA stack when deleted from cluster
Thomas Lamprecht [Mon, 28 Sep 2015 09:34:52 +0000 (11:34 +0200)]
delete node from HA stack when deleted from cluster

When a node gets deleted from the cluster with pvecm delnode
we set it's node state in the manager status to 'gone'.
When set to gone the manager waits an hour after the node was last
seen online and only then deletes it from the manager status.

When some HA services were forgotten on the node (shouldn't happen
at all!!) the node will be fenced, the service migrated and then its
state reset to 'gone'. After an hour the node will be deleted,
unless it joined the cluster again in the meantime.

Deleting a node from the HA manager status is by no means a final
act, the ha-manager could live without deleting it, but for the user
it is confusing to see dead nodes in the interface.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agobump version to 1.0-8
Dietmar Maurer [Sat, 26 Sep 2015 08:36:31 +0000 (10:36 +0200)]
bump version to 1.0-8

8 years agoUse new lock domain sub instead of storage lock
Thomas Lamprecht [Fri, 25 Sep 2015 15:50:06 +0000 (17:50 +0200)]
Use new lock domain sub instead of storage lock

Doesn't changes behaviour at all, but makes code clearer

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agobump version to 1.0-7
Dietmar Maurer [Mon, 21 Sep 2015 10:17:49 +0000 (12:17 +0200)]
bump version to 1.0-7

8 years agoenhance ha-managers' group commands
Thomas Lamprecht [Fri, 18 Sep 2015 06:19:37 +0000 (08:19 +0200)]
enhance ha-managers' group commands

add commands for adding, deleting and modifying groups. Also add
better bash completion for these commands.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agovm_is_ha_managed: allow check on service state
Thomas Lamprecht [Fri, 18 Sep 2015 09:21:02 +0000 (11:21 +0200)]
vm_is_ha_managed: allow check on service state

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoGroups: correctly set optional flag in propertyList
Dietmar Maurer [Thu, 17 Sep 2015 09:53:44 +0000 (11:53 +0200)]
Groups: correctly set optional flag in propertyList

Only group and type should be required, all other properties should
be marked optional inside propertyList. We can set correct values
for optional flag inside options().

8 years agoMakefile: use mv to create files atomically
Dietmar Maurer [Thu, 17 Sep 2015 05:51:43 +0000 (07:51 +0200)]
Makefile: use mv to create files atomically

8 years agoExtend ha_managers' man page
Thomas Lamprecht [Wed, 16 Sep 2015 13:49:28 +0000 (15:49 +0200)]
Extend ha_managers' man page

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agobump version to 1.0-6
Dietmar Maurer [Wed, 16 Sep 2015 10:06:37 +0000 (12:06 +0200)]
bump version to 1.0-6

8 years agofix includes from services
Thomas Lamprecht [Wed, 16 Sep 2015 09:25:18 +0000 (11:25 +0200)]
fix includes from services

The crm and lrm daemon executables need to include SafeSyslog, as
they use syslog in their signal handler.
Whereas it isn't needed anymore in the Service class of the daemons.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agofixing typos, also whitespace cleanup in PVE2 env class
Thomas Lamprecht [Wed, 16 Sep 2015 09:25:17 +0000 (11:25 +0200)]
fixing typos, also whitespace cleanup in PVE2 env class

fix typos through the whole project, used codespell to find most of
them.
Also do a big whitespace cleanup in the PVE2 enviorment class.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoadjust log level on failed start and error to warning
Thomas Lamprecht [Wed, 16 Sep 2015 09:25:16 +0000 (11:25 +0200)]
adjust log level on failed start and error to warning

use warning instead of info to represent the significance of the
log message

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoimplement recovery policy for services
Thomas Lamprecht [Wed, 16 Sep 2015 09:25:15 +0000 (11:25 +0200)]
implement recovery policy for services

We implement recovery policies which use settings known from
rgmanager, however the behaviour is not strictly the same,
our approach is more configurable. For example rgmanager cannot
combine its restart and relocate policy.

There are the following policy settings which kick in on an failed
service start:
* max_restart:  maxmial number of tries to restart an failed service
                on the actual node. The default is 1 restart try.
                This policy gets enforced by the LRM.

* max_relocate: maximal number of tries to relocate the service to a
                a different node. A relocate only takes place after
                the max_restart value is exceeded on the actual node
                This policy gets enforced by the CRM.

If a service is still no running after all max tries, it's state
gets set to 'error'. This means that the service needs to be checked
and disabled manually.

*Note* that the relocate state will only reset when the service had
at least one successful start. That means if a service is reenabled
without fixing the error only the restart policy gets repeated.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoimprove sid bash completion
Dietmar Maurer [Wed, 16 Sep 2015 06:32:58 +0000 (08:32 +0200)]
improve sid bash completion

8 years agouse helpers to enable advanced auto completion
Thomas Lamprecht [Tue, 15 Sep 2015 07:27:37 +0000 (09:27 +0200)]
use helpers to enable advanced auto completion

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoadd auto completion helper for service IDs and HA groups
Thomas Lamprecht [Tue, 15 Sep 2015 07:27:36 +0000 (09:27 +0200)]
add auto completion helper for service IDs and HA groups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agosimulator: fix random output of manager status
Thomas Lamprecht [Fri, 11 Sep 2015 14:57:17 +0000 (16:57 +0200)]
simulator: fix random output of manager status

Tell Data::Dumper to sort the keys before dumping. That fixes
the manager status mess of jumping keys.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 years agoremove 'exename' from CLIHandler classes (not required)
Dietmar Maurer [Tue, 15 Sep 2015 06:26:59 +0000 (08:26 +0200)]
remove 'exename' from CLIHandler classes (not required)