Commit Graph

22 Commits

Author SHA1 Message Date
Samuel Walladge f3a72cdc9f Update jobs to fix the CI
- remove old / deprecated zuul jobs
- update to the latest rolling python3 jobs
- update tox based on tox4 fixes
- update tox python targets
- add the platform mocking patch - copy from https://review.opendev.org/c/openstack/charm-nova-compute-nvidia-vgpu/+/899177/2/unit_tests/__init__.py

Change-Id: If77436f4c27cf719907a2888d5b1e9e6c7eb3f7c
2023-11-06 10:15:38 +10:30
Felipe Reyes 5fc5216f51 Add monitor for stopped services when clone=False
The cluster as its currently configured for services with clone=False,
Pacemaker will monitor exclusively that the daemon is running in the
node where it should, but will take no actions if the same daemon is
running (e.g. started manually by a sysadmin) in another node of the
cluster, this becomes a problem for services that are expected to be
configured in active/passive (e.g. manila-share).

This change configures two monitors for services with clone=False, one
that monitors the daemon is running where it should, and another one
that monitors the daemon is not running where it shouldn't.

primitive res_apache systemd:apache2 \
	...
        op monitor interval=5s role=Started \
        op monitor interval=6s role=Stopped

https://clusterlabs.org/pacemaker/doc/deprecated/en-US/Pacemaker/1.1/html/Pacemaker_Explained/_resource_operations.html#s-resource-monitoring

Closes-Bug: #1904623
Change-Id: I9e5383f5ab6b6967aa0f2318764519989a292227
2022-02-04 14:49:03 -03:00
Martin Kalcok 56710fdaf4 Update relation data even if the new value is empty
This will enable removal of previously created
resources. Originaly, the empty values were not
propagated so the resource ended up in both fields
"json_delete_resources" and "json_resources".

Closes-Bug: #1953623
Change-Id: I34693bb0e30bce96144a983e55e212e27029ba52
2021-12-13 14:27:39 +01:00
Zuul 8125a7baec Merge "Add OPS framework interface" 2021-09-21 11:35:05 +00:00
Liam Young 34b12aa480 Add OPS framework interface
Add OPS framework support and exclude ops framework file from
reactive builds.

Change-Id: I79ae194b97483072501e07e4f8c02bdad03bc19f
2021-09-21 09:44:55 +00:00
Zuul 4e8e1dfdc7 Merge "Revert "Add OPS framework interface"" 2021-09-10 08:42:35 +00:00
gnuoy 73d507e04a Revert "Add OPS framework interface"
This reverts commit 1730dfe3fd.

Reason for revert: Causing issues with reactive charms

Change-Id: Ib529b973ba8856348b0bd7383d403ceb28f235d5
2021-09-10 08:07:57 +00:00
Zuul 0471eed266 Merge "Add OPS framework interface" 2021-09-09 14:34:18 +00:00
Liam Young fa48a2151f Expose interface for colocation of services
Change-Id: I22b3158f895fd782f4dbf95347d877b6b6f492fd
2021-09-06 14:29:06 +00:00
Liam Young 1730dfe3fd Add OPS framework interface
Change-Id: If5efdd7b91661ae6b5ac9aa6c43151ce9f4577ec
2021-09-02 08:18:39 +00:00
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
Hervé Beraud 9ea447c296 Use unittest.mock instead of mock
The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we can use the
standard lib unittest.mock module instead.

Note that https://github.com/openstack/charms.openstack is used during tests
and he need `mock`, unfortunatelly it doesn't declare `mock` in its
requirements so it retrieve mock from other charm project (cross dependency).
So we depend on charms.openstack first and when
Ib1ed5b598a52375e29e247db9ab4786df5b6d142 will be merged then CI
will pass without errors.

Depends-On: Ib1ed5b598a52375e29e247db9ab4786df5b6d142
Change-Id: Ibbbcfe51e76537702a2f4612a8b9829b25b2d149
2020-06-09 17:11:21 +02: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
José Pekkarinen 4baae7a0f2
Control access to crm in cases when the unit is yet not
having any corosync resource available.

Closes-bug: #1864804
Change-Id: I6eb3b9a816a93c4c7894e17935b1e7c8604592c5
Signed-off-by: José Pekkarinen <jose.pekkarinen@canonical.com>
2020-03-03 19:43:50 +02: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
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