Commit Graph

64 Commits

Author SHA1 Message Date
Samuel Walladge d91e83a1fa Use the passed arguments in remove_dnsha
This appears to be a typo, where self.service_name and self.endpoint_type
was used in the same way as seen in other methods,
but self.service_name or self.endpoint_type is not defined in this class,
or any subclasses of it.
So we can use the passed name and endpoint_type arguments here.

Closes-Bug: #2037515
Change-Id: I12c561057372c11632b2d97fa1763fc92d89f479
2023-11-28 11:50:11 +10:30
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
Zuul 2b714e90b1 Merge "Update relation data even if the new value is empty" 2022-01-11 09:41:36 +00:00
Felipe Reyes 5451d82104 Drop six.
Charm-helpers dropped py2 support, hence charms are in the process of
dropping support for it too, this change drops the use of the `six`
library.

Change-Id: I4c76e60780e7dc1189a9fad8f8caf34c3fad5f65
2021-12-13 12:49:09 -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
Alex Kavanagh 6c611a3c61 Migrate from testr to stestr
Change-Id: I735638f91617d2e951c3ec23498c8ac116cf8f08
2021-02-10 11:18:06 +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
inspurericzhang 3fad300b7f Switch to Ussuri jobs
Change-Id: I589aadb2e73adefbab62c705d28a81732206d32a
2019-10-31 17:51:43 +08: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
Camille Rodriguez 10af229842 Avoid pollution and false positives with tox.ini
- removing sitepackages in tox.ini to avoid test env pollution
- skip_missing_interpreters in tox.ini set to False to avoid false
positives by skipping missing interpreters.

Change-Id: I3e9653753f17e68a302184a734b8fbe6fbf92df8
2019-08-27 08:54:47 -04:00
Corey Bryant 0a4425b371 Add Python 3 Train unit tests
This is a mechanically generated patch to ensure unit testing is in place
for all of the Tested Runtimes for Train.

See the Train python3-updates goal document for details:
https://governance.openstack.org/tc/goals/train/python3-updates.html

Note that python35-charm-jobs is retained since this charm is supported
on Xenial.

Change-Id: Ie5ed4bc0b8c1ecf1c870b9d7d1147c32950eec28
Story: #2005924
Task: #34228
2019-07-30 10:18:54 -04:00
OpenDev Sysadmins 0bc9985bb8 OpenDev Migration Patch
This commit was bulk generated and pushed by the OpenDev sysadmins
as a part of the Git hosting and code review systems migration
detailed in these mailing list posts:

http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003603.html
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004920.html

Attempts have been made to correct repository namespaces and
hostnames based on simple pattern matching, but it's possible some
were updated incorrectly or missed entirely. Please reach out to us
via the contact information listed at https://opendev.org/ with any
questions you may have.
2019-04-19 19:48:31 +00:00
Paul Goins b035ee30f1 Added tox environment for gathering coverage
This technique was borrowed from the tox "cover" environment in
openstack/nova's tox.ini.  This leverages the fact that stestr lets
you override the python executable via the PYTHON environment
variable.  Doing this allows us to easily generate coverage for our
unit tests.

An important caveat is that this does not provide any coverage for
tests via zaza, amulet, etc.  It is purely focused on the unit tests.

Note that this replaces the previous .coveragerc; coverage
configuration is instead pulled from tox.ini.

Change-Id: Ia0f190f7de273290d01091fd9211a4bbdb688be5
2019-03-01 14:40:18 +01:00
Mike Wilson a4b62a9a00 Adding support for deletion of vip, dns, and init services.
Change-Id: I6b0f00aaf7e3c83e1a35ed1ecb4127f743aeba6d
2019-02-15 10:34:57 -05: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
Zuul 4f9e463b44 Merge "Add ability for charms to delete crm resources" 2018-12-18 09:48:22 +00:00
Frode Nordahl 875ddd342b Add interface build ignore rules
Instruct charm tools to not include repo/test config and test code
when consuming interface to build a charm.

Change-Id: Iba7ec239094214a408105359c9f18b53a7bc0919
2018-12-18 09:50:44 +01: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
Doug Hellmann c7475b06be fix tox python3 overrides
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.

We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.

We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.

Change-Id: Id5511088f9b29a801156231f6b95d6add8b68cd5
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-09-26 18:38:40 -04:00
Doug Hellmann 68cb818c24 import zuul job settings from project-config
This is a mechanically generated patch to complete step 1 of moving
the zuul job settings out of project-config and into each project
repository.

Because there will be a separate patch on each branch, the branch
specifiers for branch-specific jobs have been removed.

Because this patch is generated by a script, there may be some
cosmetic changes to the layout of the YAML file(s) as the contents are
normalized.

See the python3-first goal document for details:
https://governance.openstack.org/tc/goals/stein/python3-first.html

Change-Id: I15f8fc216f5bddf9cd1cd29f2c1347f60ed0bee1
Story: #2002586
Task: #24317
2018-09-11 13:11:47 -04:00
Vu Cong Tuan d20c7bb5f2 Add py36 testenv
Python 3.6 is installed by default in Ubuntu 18.04 LTS.
Therefore, according to Transition Plan [1],
it'll be handy to have py36 testenv.

For more details, please check Python2 Deprecation Timeline [2]
and Python3-first Goal - Completion Criteria [3].

[1] https://wiki.ubuntu.com/Python/Python36Transition
[2] https://governance.openstack.org/tc/resolutions/20180529-python2-deprecation-timeline.html
[3] https://review.openstack.org/#/c/575933/8/goals/stein/python3-first.rst@42

Change-Id: I2b1942ffc66aa0c79a76182838fda0f369b24b78
2018-06-28 08:30:28 +07: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
James Page 8c72945ead py3: sort CRM group members
Ensure that CRM group members are sorted to avoid continual
data mutation on ha relations to the hacluster charm, which
causes restarts of services and vips.

Change-Id: I80ca19fa5f1d573827ea9cd7fe0f18c575518c8c
Closes-Bug: 1754149
2018-03-22 11:14:30 +00:00
Zuul 495e8b1f33 Merge "Do not set ha.available until clustered" 2018-03-01 15:43:00 +00:00
David Ames bf858a38bc Do not set ha.available until clustered
The interface was setting ha.available immediately with no gating.

The hacluster charm sets a relation variable, clustered, when it has
enough peers and has setup corosync. This change updates the
interface to react to this setting. Only set ha.available when
clustered is set and True.

Change-Id: I23eb5e70537a62d5b9e5e24d09f37519b63a1717
Closes-Bug: #1749280
2018-02-28 19:41:00 +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
James Page 52a760b8fb Pass data over interface using json keys
Switch to using json encoded data when passing configuration
to the hacluster charm.

Note that this requires an up-to-date version of the hacluster
charm, but ensures that data is presented consistently over the
relation due to deterministic encoding using json.

Change-Id: If2ace4b37f4152bf8bc44526b609a034433efc67
Closes-Bug: 1741304
2018-01-05 12:19:02 +00: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 c01416b7eb Ensure only VIP resources are in vip group
Fix bug I intrduces in:
77c2b25407
Where the haproxy resource was also added to vip group.

Ensure only VIP resources are added to the vip group.

Change-Id: Ie6b4ae89af74151ebb435c72a6df78174bbec87b
2017-08-21 14:48:32 -07: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
Alex Kavanagh e4743dd143 Enable the hascluster interface to do less juju work
This change stops the requires side of the interface (in a reactive
charm) from setting data on the relation that's already been set.
This has the effect of not asking hacluster to do something every time
a reactive charm (e.g. designate) does update status.

Change-Id: I750f3c41a2f0447a47cfd19bab1d4958de4577f2
Related-Bug: #1708396
2017-08-07 16:49:41 +01: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