Commit Graph

38 Commits

Author SHA1 Message Date
Alex Kavanagh 30dc3dc647 Improve platform mocking
Patch out charmhelpers.osplatform.get_platform() and
charmhelpers.core.host.lsb_release() globally in the unit tests to
insulate the unit tests from the platform that the unit tests are being
run on.

Change-Id: I7116d1232d19996e39665f5e6f15dae7b8e74118
2023-10-24 20:31:36 +01:00
Aurelien Lourot 43a2312794 Remove pause/resume logic
This is a subordinate charm and since a recent
commit [1] it shares a list of its services with
the principal charm nova-compute, which has now
the responsibility to pause and resume services. [2]

The ceilometer-agent-compute service has a
dependency to the nova-compute service anyway, so
it is impossible for this charm to resume its
service if its principal charm nova-compute is
paused. This is what also led to errors in
ceilometer-agent's post-series-upgrade hook. This
hook attempted to resume its service although
the principal service was still paused. Removing
this logic entirely solves this issue.

Validated by running openstack-upgrade and
series-upgrade tests. [3]

[1]: https://opendev.org/openstack/charm-ceilometer-agent/commit/be45f779
[2]: https://opendev.org/openstack/charm-nova-compute/commit/8fb37dc0
[3]: https://github.com/openstack-charmers/charmed-openstack-tester

Closes-Bug: #1952882
Change-Id: Ia22b53b52b541250f7f803c6708968d75e64475c
2021-12-13 16:21:15 +01:00
Aurelien Lourot be45f77945 Publish releases packages map to principal charm
For principal - subordinate plugin type relations where the
principal Python payload imports code from packages managed by a
subordinate, upgrades can be problematic.

This change will allow a subordinate charm that have opted into the
feature to inform its principal about all implemented release -
packages combinations ahead of time. With this information in place
the principal can do the upgrade in one operation without risk of
charm relation RPC type processing at a critical moment.

This is similar to
https://review.opendev.org/c/openstack/charm-interface-keystone-domain-backend/+/781658
https://review.opendev.org/c/openstack/charm-layer-openstack/+/781624

Change-Id: Ibd5bdcb141fc3103ee97123ff284fb2957802eba
Closes-Bug: #1927277
2021-10-04 14:36:24 +02:00
Aurelien Lourot b80626deac Remove do_openstack_upgrade()
This is a subordinate charm and doesn't have an
openstack-origin config option.

Change-Id: Id10069c55e49926cf38439a9a3b0dbede7d1e994
2021-09-24 17:35:01 +02:00
Cornellius Metto 9fd4ea0a39 Add configurability to polling.yaml.
The ceilometer compute agent uses the default polling.yaml
from the installed packages without the ability to configure its contents.

This change adds two configuration options: 'polling-interval' and
'enable-all-pollsters', borrowing from the implementation in
charm-ceilometer. We start off with a limited set of meters as before
and if these are not enough, the user can set 'enable-all-pollsters' to
'true' to collect all available 'Pollster' metrics as listed in the
documentation [1].

Verification:
I tested this change on a cluster built from the OpenStack base bundle
and the ceilometer and gnocchi charms. I confirmed that extra metrics
that originate from the Compute Agent pollster (e.g. disk.device.read.latency)
are available in gnocchi after setting 'enable-all-pollsters' to true.

[1] https://docs.openstack.org/ceilometer/latest/admin/telemetry-measurements.html

Closes-Bug: #1914442
Change-Id: I21c9a93e7dd91bced9365e44f3e6a5315976c3bb
2021-05-12 17:30:00 +03:00
Alex Kavanagh a924a071fd 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: I602a2a9c241de5898f737aacec6f85390d0be4f7
2020-09-27 15:31:34 +01:00
Rodrigo Barbieri 2aace2fb69 Receive polling-batch-size config
Samples collected can be batched together,
consequently increasing or reducing the
amount of API calls and body data
sent to the configured publisher.

This config is available since Rocky,
receiving the value from ceilometer-charm
to allow its tuning.

Change-Id: I986073fdacd750cf96d662abf1d58844479c25ba
Closes-bug: #1885190
2020-09-17 15:35:49 -03:00
Hervé Beraud ecfe23ca66 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: Ibddd954daaf3cd008985ff27cd95dfe649476555
2020-06-09 15:12:56 +02:00
Alex Kavanagh 7ea0be57de Convert the charm to Python 3
Change-Id: I8c8df27be189098be363d0ea125f86e59fdbb020
2019-03-13 12:29:49 +00:00
Corey Bryant d9430f9bd2 py3: handle shared subordinate dependencies on upgrade
Switch to marking non-leaf python-* packages as automatically
installed so that they will be purged once the last remaining
package that depends on them that was manually installed is
removed.

Change-Id: If821cb511a2fdb65ac3e8ad8db88a00770864d42
Closes-Bug: 1802400
2018-11-15 18:18:31 +00:00
Liam Young 1a40c275d5 Remove independent OpenStack upgrade
Ceilometer has had an openstack-origin and supported upgrading
the Ceilometer version independently of the principle that it is
associated with. This can cause issues with clashes in package
dependencies between the two. This change makes the
ability for the agent to be upgraded independently of the principle
and instead has the upgrade triggered by the principle. This brings
this charm inline with the other OpenStack subordinate charms.

Change-Id: I641ac2168ac705191d916eaa0624214791e1745d
Closes-Bug: #1802400
2018-11-11 18:44:29 +00:00
Ryan Beisner 88c4516a48
Fix lint in unit test
Change-Id: If2c3d36bff41a65bf928e4ee42986722c7a4df30
2018-11-01 14:58:07 -05:00
Corey Bryant fde3d76e3e py3: Switch to using Python 3 for rocky or later
Switch package install to Python 3 for OpenStack Rocky or later.

When upgrading, remove any python-* packages that where explicitly
installated and then autoremove --purge any dependencies that are
no longer required.

Change-Id: If189859cbc98f326adb5b1da8d31e9a20da95af9
2018-09-19 11:13:53 +00:00
Ryan Beisner 6577c50185 Sync charm-helpers
Notable issues resolved:

openstack_upgrade_available() broken for swift
https://bugs.launchpad.net/charm-swift-proxy/+bug/1743847

haproxy context doesn't consider bindings
https://bugs.launchpad.net/charm-helpers/+bug/1735421

regression in haproxy check
https://bugs.launchpad.net/charm-helpers/+bug/1743287

Change-Id: Ic9ca0350a238cb0c8f23f4335c7ea487a6662b20
2018-01-19 16:48:05 +02:00
Liam Young 958dfc3e2f Address all rabbit units in clustered deploy
If rabbitmq is deployed in a cluster then the ceilometer charm will
pass rabbitmq_hosts and rabbitmq_host to ceilometer-agent. This charm
was ignoring the rabbitmq_hosts key and thus always talking to a
single rabbit even if there were multiple.

Change-Id: I42c2e3ee4ee2bd1feb9815a4d9895a7121801995
Closes-Bug: #1670273
2017-11-06 10:20:55 +00:00
zhangyangyang e62dec8b0d change assert(Not)Equals to assert(Not)Equal
According to http://docs.python.org/2/library/unittest.html
assert(Not)Equals is a deprecated alias of assert(Not)Equal.

Change-Id: Idfca0b18bbbede9bf6afb7b6ead902d4abcc04eb
Closes-Bug: #1329757
2017-09-12 21:20:55 +08:00
Corey Bryant 2c47665758 Reset os_release cached value after upgrade
In enable_memcache, ensure that the os_release cache is reset
after upgrade.

Additionally, call apt_install(get_packages()) for upgrades
to ensure that release-specific packages (such as memcached)
are installed.

Change-Id: Ia3689d2d0c549fc55f1bd533654f80c98ce5462a
Partial-Bug: 1715624
2017-09-07 21:18:36 +00:00
James Page fb1836cbcf Update for newer OpenStack releases
Update configuration supplied to nova-compute charm to switch
to real notification drivers, rather than old/obsolete keys
which are not longer supported.

Change-Id: Ic58fa78ae80d88113abc5e2f8361a143ba380d01
2017-08-01 15:50:41 +01:00
Liam Young c775293654 Enable Memcache service for Token Caching
With the release of 4.2.0 of keystonemiddleware using the
in-process token cache is no longer recommended. It is recommended
that a memcache backend to store tokens is used instead,

This installs and configures memcache and configures ceilometer agent
to use memcache for token caching.

http://docs.openstack.org/releasenotes/keystonemiddleware/mitaka.html#id2

Change-Id: If7dd4c5472a7842f06d0fd44c1b2012c9c9d1075
2016-12-13 17:07:21 +00:00
Frode Nordahl a904456fe3 Fix support for Keystone v3 domain auth
When using v3 authentication and authorization Ceilometer must
authenticate to services project in service_domain.

Change-Id: Ibb19fa8476cf712ccb4bc524a48d3501f42fc62c
Closes-Bug: 1636098
2016-11-29 23:36:49 +01:00
Zhang Hua fa77346e98 Add keystone v3 support
Use shared section template for keystone authotken and update
service_credentials section to support Keystone v3 for OpenStack
Mitaka or later.

Change-Id: Ia7750276e6a6a52dc95a93f1d5cb8d1f544a94d5
Closes-Bug: #1624173
2016-10-07 17:05:19 +01:00
James Page 3d3b26ded6 Add support for application version
Juju 2.0 provides support for display of the version of
an application deployed by a charm in juju status.

Insert the os_application_version_set function into the
existing assess_status function - this gets called after
all hook executions, and periodically after that, so any
changes in package versions due to normal system updates
will also be reflected in the status output.

This review also includes a resync of charm-helpers to
pickup hookenv and contrib.openstack support for this
feature.

Change-Id: I0cef2ddc2dfc04bb6631ec61e7f890ebae94961f
2016-09-20 12:01:50 +01:00
James Page 616f05866b Re-license charm as Apache-2.0
All contributions to this charm where made under Canonical
copyright; switch to Apache-2.0 license as agreed so we
can move forward with official project status.

Change-Id: I081ca71ffd24c8169bed053c351ad4019956e99b
2016-06-28 11:40:19 +01:00
Alex Kavanagh ed5416c6b8 Enhanced pause and resume for maintenance mode
Adds improved pause and resume unit to the charm such tha the
charm stays paused during maintenance operations.
Sync latest version of charm-helpers for maintenance mode.
Amulet test for pause/resume actions

Change-Id: I3ec090fb9eb85561834b79003606c4d4b38dc84c
2016-03-18 16:31:17 +00:00
James Page 861de65957 Add tox support 2015-11-02 09:52:06 +00:00
Corey Bryant 1d9e1ae2ed Import CONFIGS instead of calling register_configs() again. 2015-09-22 20:46:52 +00:00
Corey Bryant aacf5f854a Fix unit test 2015-09-15 18:43:44 +00:00
Corey Bryant cca3937327 Update unit tests 2015-09-15 18:34:20 +00:00
Corey Bryant 133463f874 Unit tests 2015-09-15 16:59:02 +00:00
Ryan Beisner ead83ce356 add amulet tests 2015-06-26 17:41:54 +00:00
Jorge Niedbalski 300ffddad7 - Fixes LP:# 1444015 2015-04-14 13:06:52 -03:00
Liam Young 0a5b435f3c Update bradms branch to add nrpe support 2015-01-26 08:00:21 +00:00
Corey Bryant 866be8af9a Mock out config(). 2014-12-11 02:46:41 +00:00
James Page d9f2fab0bb Add upgrade support 2014-04-01 17:53:45 +01:00
James Page 355389ca0f Fixup ssl handling 2014-03-28 15:33:10 +00:00
James Page 4c59c6a149 Adjust context for ceilometer relation to pick specific data 2013-12-17 15:00:42 +00:00
James Page 4675989c61 Add locally scoped relation for passing nova configuration 2013-11-29 15:34:44 +00:00
James Page 983929d169 Add unit tests 2013-10-20 15:28:18 -07:00