Commit Graph

22 Commits

Author SHA1 Message Date
Liam Young 679a76dfe5 Move common requires code
Move common requires code in to the common module so that
requires.py only contains the code which is specific to
reactive charms. This will allow for a subsequent patch which
creates a requires interface consumable by operator framework
charms.

Change-Id: I70037252cc7a677a9394929cb0cd17e9506ab624
2021-08-26 12:03:41 +00:00
Liam Young 67511b3787 Resource parameter order is important on Eoan+
Port of https://github.com/juju/charm-helpers/pull/373 to this
interface for reactive charms. From the ch pull request:

On Eoan we saw errors like:

ERROR: syntax in primitive: Attribute order error: timeout must appear
before any instance attribute parsing 'primitive res_ks_cf9dea1_vip
ocfheartbeatIPaddr2 params ip=10.5.253.30 op monitor depth=0
timeout=20s interval=10s'

It would appear, that ordering matters, update resource config function
to the correct order.

Change-Id: I1f8a440fb0ad62192307946de42b9b176b3ef4c1
Partial-Bug: #1843830
2020-04-22 08:54:02 +00:00
George Kraft ef1f8503f4 Make SystemdService never give up on resources
Change-Id: Icd202be7cf55f8bd883d102c81881ed15a0e5191
Closes-Bug: #1859044
2020-04-07 13:30:17 -05:00
Zuul 38590837da Merge "Never give up on resources" 2019-10-01 15:36:20 +00:00
David Ames fe9d009520 Never give up on resources
Configure pacemaker to never give up on resources and
to recheck 5 seconds after a failure. This is achieved
using migration-threshold and failure-timeout options *1.

*1 https://clusterlabs.org/pacemaker/doc/en-US/Pacemaker/1.1/html/Pacemaker_Explained/_failure_response.html

Change-Id: I4044810daa83f9bd7a59430b5c52c009149fac6e
Partial-Bug: #1839021
2019-09-17 17:10:40 +02:00
Mike Wilson e1d44c258a Add support for systemd
Systemd support is in corosync, but currently the add_init_service
handles adding an upstart service only. This results in Charmed
Kubernetes having incorrectly monitored services.

Change-Id: I935613292ce6b78cf645469fda6d21b0aa695c28
Closes-Bug: #1843933
2019-09-13 14:11:07 -04:00
Frode Nordahl 7c2e09450a
Fix Python3.4 compability
Add Zuul unit test job

Change-Id: I2dbcd27db0d1791c06c212b07f23d1f26e1fd5ad
Closes-Bug: #1814218
2019-02-01 14:37:33 +01:00
Liam Young a85b2d23c1 Stop duplicates being added to delete_resources
Stop duplicates being added to delete_resources.

Change-Id: I31a2e5e97abda0106891bcc0d9040cda00629b96
2018-12-19 11:30:53 +00:00
Liam Young 472fd77c93 Ensure deleted resources are removed from local db.
Currently resources that are marked for deletion are not removed
from the local reactive charm resource map. This means that on
charm upgrade the charm will rerequest resources that
are marked for deletion as well as requesting they are deleted.

Change-Id: I68c57307c9e5b0a5743ac3105e48668b2e436957
2018-12-18 16:58:19 +00:00
Liam Young 087ddb3936 Add ability for charms to delete crm resources
Change-Id: I407b40fe154a30de6e607849126d71fbc99fd158
2018-12-18 08:24:28 +00:00
Liam Young ce2aa63653 Add unit tests and fix for _parse bug exposed
* Add unit tests for common.py and requires.py.
* Update tox env for above.
* Update gitignore to ignore common kruft.
* CRM._parse did not add a space when constructing 'results' after
  each argument of 'data'. This caused each element to run into the
  last.

Change-Id: I2c35820149618aae02171c89b26bf29ee5e22344
2018-12-17 16:28:35 +00:00
David Ames ab38cf8b07 Monitor VIPs
The interface was failing to setup monitoring for Virtual IPs. If for
some reason a VIP failed on an instance corosync would fail to notice
it.

This change adds the op monitor setting to monitor VIPs.

Change-Id: If885340f04b8834fa4604ab742c7facfc6f316ad
2018-12-03 16:07:51 -08:00
Liam Young ad21b5daed Make specifying the nic optional
If a nic is not specified when setting up a vip resource then
corosync should just do the right thing. This change makes the nic
field optional as there is little benefit in using it.

Change-Id: I022a43df0a50a21df3c5f021dcd563da4d20db53
2018-04-17 10:18:53 +00:00
Billy Olsen 44c900958f Reassign init and delete services instead of extend
The CRM.delete_services(...) and CRM.init_services(...) methods
update the internal list used to communicate with the hacluster
charm. This causes the list to continuously grow, which causes
the data in the hacluster relation to change. The constantly
updated relation change causes hooks to fire unintentionally.

Change-Id: Ica823027b1a3fafe277d862fae0a3cdcf5907774
Partial-Bug: #1737776
2018-02-27 06:55:47 -07:00
Liam Young 09ead5622e Add functions for managing DNS Entries
Add code for managing DNS Entries via hacluster. This is part of the
effort to enable DNS HA in the reactive charms.

Change-Id: I1a6cdeffa3aa8657b957ba68cd09face27f93b27
Partial-Bug: #1727376
2017-10-26 21:47:26 +01:00
David Ames 77c2b25407 Dualstack IPv4/IPv6 support
Allow for two VIPs on a single interface as in IPv4/IPv6 dual
stack scenarios.

Add missing group membership for VIPs.

Change-Id: Ieba9fd453efcd3d407baaeb8d0d6f3f71750060e
2017-08-17 15:47:13 -07:00
Liam Young 13ad020e36 Principle sends invalid config to hacluster
When requesting hacluster manage an init service the principle
sends options to hacluster but is currently erroneously sending
the word 'param' as well. eg

The pinciple is setting:
''res_designate_haproxy'': ''  params op monitor interval="5s"''

When it should be:
''res_designate_haproxy'': ''op monitor interval="5s"''

Including the word 'params' evenutally causes hacluster to fail with:
ERROR: syntax in primitive: params op monitor interval=5s

Change-Id: Id35bb22692914dc3f94465d8ae7d62971a238d4e
2016-07-26 18:13:51 +00:00
James Page 05d0c44103 Update InitService to support optional cloning 2016-06-21 12:51:35 +01:00
Liam Young 3e1adbf909 Added docstring, lint fixes and general tidyup 2016-06-08 14:03:50 +00:00
Liam Young e5f2140cf5 Add more common code
Add methods for setting up hacluster resources in interface to allow external
code to cleanly call <interface>.add_<resource> rather than having to import
specific methods from common.py
2016-06-01 11:03:43 +00:00
Liam Young 507eba5f92 There is a typo in the name of the init_Services key, the S should not be a capital 2016-05-11 15:15:30 +01:00
Billy Olsen a73846f575 First commit of the proposed hacluster interface.
This commit includes a rough implementation of the hacluster
interface which allows a charm to interact with the hacluster
subordintate charm.
2016-01-05 21:22:27 -07:00