Commit Graph

647 Commits

Author SHA1 Message Date
Rafael Lopez a86390aeab Additional check to replace missing seeded file
The additional check is based on cluster being bootstrapped and the last
backup being a SST.

The change includes new function for checking the last backup was SST and unittests to verify said function as well as the main charm_check_func where the check is used and seeded file is replaced.

Closes-Bug: #2000107
Signed-off-by: Rafael Lopez <rafael.lopez@canonical.com>
Change-Id: I8e516059da5299cc0e0ce8ef0802d3a46abb1a54
2023-01-27 08:34:44 +00:00
Rafael Lopez 43b98b6416 Minimal update to tox.ini for tests to pass
- remove pip.sh
- unpin top level requirements
- update charm-tools version for pep8 test
- update osci.yaml tox_extra_args for compatibility

Signed-off-by: Rafael Lopez <rafael.lopez@canonical.com>
Change-Id: Iec9fbd296d6d5b5fa647739d5588218c28e0a773
2023-01-17 03:58:22 +00:00
Mert Kırpıcı 9905ca13ee Revert "Added NRPE requested governor CPU check"
This is being handled in the nrpe charm now.

See MP #427905 in LP:
https://code.launchpad.net/~mertkirpici/charm-nrpe/+git/charm-nrpe/+merge/427905

This reverts commit 7d240fa354.

Signed-off-by: Mert Kırpıcı <mert.kirpici@canonical.com>
Change-Id: Iad0cf612e1333a1d89b6ccaca5161e84b7b020aa
2022-08-12 19:32:13 +03:00
Guilherme Maluf Balzana a3f65978a7 Fix log message when catching `get_wsrep_value` exception
`get_wresp_value` can fail in `cursor.execute()` and no log
message would be written.

This commit fix and ensure the right message is logged.

Closes-Bug: #1942936
Change-Id: Idbb1170bbf43fdecec233137d6581bf8f799baa9
2022-07-20 11:51:21 +02:00
Chi Wai, Chan 66f004c2ba Add an option to allow MySQL service to log to syslog.
This patch provides one of the alternative solution to address the
problem that the error log might grow too large.

Closes-bug: #1812950
Change-Id: If7c0c71492eb30f24cbcc03ca05a67e6ea571f4e
2022-06-28 13:53:16 +08:00
Liam Young 6e42563bf4 Sync test-requirements.txt from release-tools
Change-Id: I8c880069d152603ca3dded43bdedf39e4565385f
2022-06-27 09:35:26 +00:00
Alex Kavanagh 6751832bb6 Migrate percona-cluster to charmcraft build
- add *.charm  to .gitignore
- add build-requirements.txt
- add charmcraft.yaml (build on 18.04, run on 18.04)
- modify osci.yaml to do build
- add rename.sh to clean-up naming of charms
- modify bundles to work with *.charm and use the charmhub
- modify tox.ini to include the build target

Note that this charm doesn't officially support xenial, but the bundle
has been left in the tests for debugging/test purposes.  It Launchpad it
will be build on bionic to run on bionic.

This patch adds *.charm to the .gitignore to ensure that any built
artifacts are ignored.

Change-Id: Icd4942262a8dfcd3a194684571861121d92f8ed2
2022-05-20 16:08:07 -07:00
Hervé Beraud 6ff8acbd6a 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: Ie96a81d19be4f14efc7067ddb9c47827f5255ccf
2021-12-15 11:11:14 +00:00
Corey Bryant 50f3f31f47 Switch to yoga unit jobs and add py39
Change-Id: I951c774ef57b5437d7e624936f67fdbf6c383d58
2021-11-17 14:49:35 -05:00
Corey Bryant 393afdd1e7 Remove xenial metadata and function tests
Drop xenial metadata and function tests as the next release of
the charms won't support xenial. xenial-queens-ha-series-upgrade
was not dropped as it still seems useful to test.

Change-Id: I27005eb7c149f788a14a68fad1b700b374697dd3
2021-11-12 11:09:26 -05:00
Corey Bryant e3091504fe Add yoga bundles and release-tool syncs
* charm-helpers sync for classic charms
* pin pyparsing for aodhclient
* pin cffi for py35
* add non-voting focal-yoga bundle
* add non-voting jammy-yoga bundle
* add series metadata for jammy
* switch xena bundles to voting
* run focal-ussuri as smoke tests
* remove groovy bundles

Change-Id: I7d9f44bd0dbff25a6c2b0649aa3a86c1869cd7d8
2021-11-05 13:53:31 -04:00
Zuul 5728e15fb6 Merge "Added NRPE requested governor CPU check" 2021-10-06 00:05:15 +00:00
Alex Kavanagh e1ca4001ac charm-helpers sync for 21.10 release
- charm-helpers sync for new charm-helpers changes
- update tox/pip.sh to ensure setuptools<50.0.0

Change-Id: If2397cf401d1bcec3ff7c622fa9e3477291fc7eb
2021-09-28 13:02:13 +01:00
Diko Parvanov 7d240fa354 Added NRPE requested governor CPU check
Change-Id: Ib03c29f14388476f00e42b406d8d1c86152e6757
2021-09-10 11:32:29 +03:00
Nicholas Njihia 75fcf19f33 Add max_connect_errors configuration option.
This change adds the config option max_connect_errors for MySQL to this
charm and sets a default of 100.
Commit also includes the inclusion of this (default) config setting in the
unit tests.
Closes-Bug: #1776908

Change-Id: I33b9e29bd64ad8a1fec0edc3dfd657a87648b537
2021-09-02 18:15:22 +03:00
Billy Olsen fc9b9dbcb9 Don't configure databases to replicate w/out async
Check that that the asynchronous replication relations exist prior
to providing the databases_to_replicate to the templating engine
code. Specifying the databases-to-replicate config option is not
supposed to apply when the asynchronous relation is not established.

Closes-Bug: #1934680
Change-Id: Iedd0532268f0bf533305412105590c5afdd7c0ec
2021-08-16 16:46:08 -07:00
Aurelien Lourot 524a3572f3 Sync release-tools
In order to fix ResolutionImpossible on tox invocation.

https://github.com/openstack-charmers/release-tools/issues/151
https://github.com/openstack-charmers/release-tools/pull/152

Change-Id: I7e20ce898d770ce93e784f123e172f39eab7a2db
2021-07-22 15:00:29 +02:00
Zuul 6d2fbbaa20 Merge "c-h sync - restore proxy env vars for add-apt-repository" 2021-06-04 23:35:43 +00:00
yangyawei 274165bcac setup.cfg: Replace dashes with underscores
Setuptools v54.1.0 introduces a warning that the use of dash-separated
options in 'setup.cfg' will not be supported in a future version [1].
Get ahead of the issue by replacing the dashes with underscores. Without
this, we see 'UserWarning' messages like the following on new enough
versions of setuptools:

  UserWarning: Usage of dash-separated 'description-file' will not be
  supported in future versions. Please use the underscore name
  'description_file' instead

[1] https://github.com/pypa/setuptools/commit/a2e9ae4cb

Change-Id: I32a6b4aa31c9b58ac632025670f50a065120c109
2021-05-14 18:24:06 +08:00
Corey Bryant bc762294c6 c-h sync - restore proxy env vars for add-apt-repository
Change-Id: Id512e0c6684ec4ccab7f917b0a4bb6caf4f78222
2021-05-13 08:47:36 -04:00
Alex Kavanagh 570ab6f465 Updates to flip all libraries back to master
This patchset updates all the requirements for charms.openstack,
charm-helpers, charms.ceph, zaza and zaza-openstack-tests back
to master branch.

Change-Id: Iecc63d575d0ed1b1d533766888e16b061adb626c
2021-05-03 16:10:32 +01:00
Alex Kavanagh 432c3f0be4 Ensure that nagios user gets created with a password
The associated bug is due to a change introduced in commit d55dcde
which was to ensure that the correct password update is used for
different versions of mysql (pre and post 5.7.5).  However, this change
has broken the nagios user creation due to not setting the password.

This patch creates the nagios user and passord at the same time.  The
updating of the password is only done if the account already exists.

The change also corrects the nagios password store in leader-settings to
the 'mysql-nagios.passwd' key instead of 'nagios-password'.  This was an
unfortuante error when the nagios change password was introduced.  The
charm detects if the 'nagios-password' key is used on charm-upgrade and
moves it to 'mysql-nagios.passwd'.  This enables the key to work with
the standard MySQLHelper functions.

Finally, the ALTER command (on percona) doesn't update non-InnoDB tables
and thus needs to be run for each unit when the nagios password is
changed via the action.  The changes in percona_utils.py enable this to
happen.

Whilst the change looks large it ONLY affects the nagios password parts
of the charm.

The related bug is a tracking bug to serve as a reminder to fix this in
charm-helpers and this charm (i.e. make the charm-helpers code work to
change a password for any user other than root, and then enable this
charm to use that code).

Change-Id: Ibc751bef7b4654ebffdf843c556b193373e6e80c
Related-Bug: #1925377
Closes-Bug: #1925042
2021-04-21 18:17:45 +01:00
Alex Kavanagh 4f51930798 21.04 sync - add 'hirsute' in UBUNTU_RELEASES
The 'hirsute' key in c-h/core/host_factory/ubuntu.py:
UBUNTU_RELEASES had been missed out, and is needed for
hirsute support in many of the charms.  This sync is to
add just that key.  See also [1]

Note that this sync is only for classic charms.

[1] https://github.com/juju/charm-helpers/pull/598

Change-Id: Ia190032a975de9bd242c724e54407918be817bc5
2021-04-11 17:00:13 +01:00
Alex Kavanagh cc72eee482 21.04 libraries freeze for charms on master branch
* charm-helpers sync for classic charms
* build.lock file for reactive charms
* ensure tox.ini is from release-tools
* ensure requirements.txt files are from release-tools
* On reactive charms:
  - ensure stable/21.04 branch for charms.openstack
  - ensure stable/21.04 branch for charm-helpers

Change-Id: I520e34a35b250954c0691250c779eee6e804c749
2021-04-03 20:37:28 -07:00
Zuul 6b7b31e8b1 Merge "Add new osci.yaml" 2021-03-11 13:21:24 +00:00
Alex Kavanagh d55dcdebc9 Ensure that correct password update is used for mysql version
On mysql pre 5.7.5 and older (e.g. xenial) a different password update
SQL statement is needed.  Detect the ubuntu version (assuming the
packages are used) and use the version for that password.

Change-Id: Ifd73f20c2523de164fb23e8f5a5e757393d489e3
Closes-Bug: #1916672
2021-02-27 15:42:55 +00:00
Chris MacNaughton d3937a1ab3 Add new osci.yaml
This change is preparatory to migration Ubuntu OpenStack CI
from Jenkins to Zuul

Change-Id: Id44d2037d5743bc882388141d726194c51d82fbf
2021-02-18 08:38:20 +01:00
Alex Kavanagh af9c467e35 Updates for testing period for 20.01 release
Includes updates to charmhelpers/charms.openstack for cert_utils
and unit-get for the install hook error on Juju 2.9

* charm-helpers sync for classic charms
* rebuild for reactive charms
* ensure tox.ini is from release-tools
* ensure requirements.txt files are from release-tools
* On reactive charms:
  - ensure master branch for charms.openstack
  - ensure master branch for charm-helpers
* Include NoNetworkBinding late fix.

func-test-pr: https://github.com/openstack-charmers/zaza/pull/409
Change-Id: I1a97004410c5cf4ef98164281137bce46756b12c
2021-01-20 10:19:14 +00:00
Zuul 7bbfb3408e Merge "Updates for testing period for 20.01 release" 2021-01-13 20:29:48 +00:00
Alex Kavanagh e586074e60 Updates for testing period for 20.01 release
* charm-helpers sync for classic charms
* rebuild for reactive charms
* ensure tox.ini is from release-tools
* ensure requirements.txt files are from release-tools
* On reactive charms:
  - ensure master branch for charms.openstack
  - ensure master branch for charm-helpers

Change-Id: I99b9f3570549921b40c937a983c2624e254bc677
2021-01-12 15:43:19 +00:00
Aurelien Lourot 712bb3d7e8 Remove Disco and Eoan bits
Change-Id: I6f9833e4b5a17e6b5a2ada4426bf02a991253dca
2021-01-12 14:03:29 +01:00
Zuul eac7bceb0c Merge "Raise file limits to allow max-connections >4190" 2020-12-17 20:11:22 +00:00
Peter Matulis 4335d0b525 Improve deprecation text
This improves the messaging surrounding the
deprecation of this charm.

Fix links.

The removed upstream links will be placed in the
linked CDG resource (on upgrading to non-focal
series).

Change-Id: I6c00fa9f452583cdf5072938e57b4cf611a3115f
2020-12-16 12:57:51 -05:00
Aurelien Lourot 151034b84e Sync release-tools
Sync release-tools boilerplate containing these changes
in order to pin pip < 20.3:
https://github.com/openstack-charmers/release-tools/pull/125
https://github.com/openstack-charmers/release-tools/pull/126
https://github.com/openstack-charmers/release-tools/pull/127
https://github.com/openstack-charmers/release-tools/pull/129

Change-Id: I9b801a2ca6c7679117fcd2322cc324c7a8d8077b
2020-12-15 11:17:06 +01:00
Trent Lloyd 5952b3de01 Raise file limits to allow max-connections >4190
Install a systemd unit override with LimitNOFILE raised to the required
number based on the same calculation the server performs to ensure both
the requested max_connections and table_open_cache values can be met.

The MySQL server does make some attempt to do this itself when started
as root which worked under Xenial, however in Bionic the systemd service
is started as the mysql user with LimitNOFILE=5000. As a result, the
server cannot raise the limit itself and caps max-connections to 4190,
table-open-cache to 200 and logs a warning to that effect:
[Warning] Changed limits: max_connections: 4190 (requested 12000)

More background:
https://www.percona.com/blog/2017/10/12/open_files_limit-mystery/

Change-Id: I25b429cc9b4970e3d7ef39bb9e6d738fe943686f
Closes-Bug: #1905366
2020-11-30 19:50:16 +08:00
Robert Gildein 11ee1ef563 NRPE: Monitor threads connected to MySQL.
Add a NRPE check to monitor the number of threads connected
to the MySQL database, in proportion to the maximum number of connections.
For this check, a nagios user will be created. This user does not have any
permissions set, does not have access to any database and can only connect
from localhost.
Warning and Critical thresholds (in percentage) can be configured.

Add an action to reset nagios's password. This action could only be run
on the leader unit.

Closes-Bug: #1816759
Change-Id: Id35b0331322c2744a9f839b3eb153eed1bc53aac
2020-11-27 14:50:02 +00:00
Alex Kavanagh 2962cc9a9a Ensure that c.c.unitdata.kv is properly mocked out
As unit tests run concurrently, it's important that all tests use a
mocked out version of the kv() store.  Otherwise, unit tests can race
and fail due to SQLite lock erros.  See linked bug for details.

Change-Id: I7e16a566531a7faf9d3a960c3df524fd46976a2a
Closes-Bug: #1905760
2020-11-27 10:20:31 +00:00
Zuul da304cbea6 Merge "React to `source` or `key` changes" 2020-11-26 15:01:38 +00:00
Robert Gildein b5726aa07c React to `source` or `key` changes
After changing the `source` or `key` in the configuration,
the `config-changed` hook was activated, but did not call `add_source`
and `apt_update`.
This logic has been added to the `config-changed` hook as well as
the state changed to `blocked` if the addition of a new source
or key fails.

Closes-Bug: #1893034
Change-Id: I0e7afd5a06c4945341329dd96e8eef3016367386
2020-11-25 17:33:33 +01:00
Peter Matulis bf6cecd936 Move cold boot section to CDG
Also move the section up the page to reflect
its importance.

Depends-on: Ic7ad2622b6aa3c8ae8821a8f5f531534d8cfb3d6
Change-Id: I31ba8a968cd7f42d639e1843e66714dbd0a067aa
2020-11-11 15:40:44 -05:00
Chris MacNaughton a197911d6c Batch update to land Ubuntu Groovy support into the charms
Cherry-Pick from 09752a1527

Change-Id: I6896ca04c10468466d2956909bc9a8df69319f03
2020-10-12 11:23:57 +02:00
Alex Kavanagh a4635c13a8 Sync libraries & common files prior to freeze
* charm-helpers sync for classic charms
* charms.ceph sync for ceph charms
* rebuild for reactive charms
* sync tox.ini files as needed
* sync requirements.txt files to sync to standard

Change-Id: I1bf6a834b3678f631f6335af9f0e8b779f863c66
2020-09-27 19:39:08 +01:00
Alex Kavanagh 1b813d1fd9 Fix series-upgrade issue where seeded file goes missing
During resume on a non-leader unit, the 'seeded' file can go missing
when the package syncs over to the /var/lib/mysql or
/var/lib/percona-xtradb-cluster directories (vivid+).  It's not really
clear why it doesn't do this every time (i.e. not every non-leader unit
fails), but this fix ensures that if the unit *is* seeded prior to the
series-upgrade, then it stays seeded after the series upgrade.

The related zaza-openstack-tests change [1] is about fixing the
series-upgrade test.

Note there is no trusty-mitaka test here as the charm doesn't support
trusty.  The last version of percona-cluster in the charm store that
supports trusty is rev. 276

[1]: https://github.com/openstack-charmers/zaza-openstack-tests/pull/406

Change-Id: I628be1c24081d7e0e150e5064c5fa4ab694632e9
Closes-bug: #1868326
2020-09-04 18:22:17 +01:00
David Ames 7eddd6074d Guarantee executable OCF mysql_monitor file
Closes-Bug: #1890470
Change-Id: Iee0aa8b1ae0f364d01d30a61381af222a264b090
2020-08-07 06:22:12 +00:00
Alex Kavanagh f2916a4f09 Release sync for 20.08
- Classic charms: sync charm-helpers.
- Classic ceph based charms:  also sync charms.ceph
- Reactive charms: trigger a rebuild
- sync tox.ini
- sync requirements.txt and test-requirements.txt

Change-Id: Ib42a0228f299acbd9dc6a9b9c6c232f0fedbfc16
2020-07-27 20:59:12 +01:00
Aurelien Lourot 85e8536480 Remove Groovy from metadata
Also remove unused Disco test bundle.

Change-Id: I4357def0540caa1911c0a47821f1bfddf5da7028
2020-07-10 10:37:27 +02:00
Alex Kavanagh 9f90f8803b Updates for 20.08 cycle start for groovy and libs
- Adds groovy to the series in the metadata
- Classic charms: sync charm-helpers.
- Classic ceph based charms:  also sync charms.ceph
- Reactive charms: trigger a rebuild

Change-Id: Id9e0319806471fa4d074c77bff105e2083313e19
2020-06-02 14:36:53 +01:00
Peter Matulis eedd374fa1 Remove series upgrade steps
The information provided in the CDG is now favoured.

Change-Id: I0f90c4fc9d1928579fc538bfea87e01aa23e6311
2020-05-26 14:44:01 -04:00
Zuul ae18cdac49 Merge "Check seeded file in update-status" 2020-05-21 22:31:45 +00:00
Zuul bc74892469 Merge "Mark seeded on cluster-relation-changed" 2020-05-21 22:31:45 +00:00