Commit Graph

109 Commits

Author SHA1 Message Date
Gabriel Adrian Samfira dcbebab56c
Add missing region setting in service_credentials
This change adds the missing region setting in service_credentials. In a
shared keystone multi region setup, this setting is mandatory in order
for ceilometer to properly find the services it relies upon from the
same region it resides in. Without this setting, the ceilometer-upgrade
action will fail (along with any other calls made to ceilometer) if the
first endpoint returned by keystone is from a different region.

Change-Id: Ie14df0f5fc7ee18072091dbdb3ada817615a6670
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-01-05 17:59:18 +02:00
Alex Kavanagh a1b25b993a 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: I89fd1e19dd946f037615f9115e08aba8d78826db
2023-10-24 20:16:43 +01:00
Alex Kavanagh 074e8085a7 Migrate charm to charmhub latest/edge track
Change-Id: If6ecb9a650054944b89606d4c4117a8aea1af868
Co-authored-by: Aurelien Lourot <aurelien.lourot@canonical.com>
2022-01-28 16:23:13 -07:00
Hervé Beraud dc22f20319 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: I27ccd34f2337533b217d8c6f817a6d5a14e47abb
2021-12-15 11:06:20 +00:00
Arif Ali f046895cdb Revert "Add meter-sink as an option"
This reverts commit 6ed691807d.

The meter_sink is actually required in pipeline.yaml and not in
event_pipline.yaml, and this is something that needs to be enabled
for newton and above as the ceilometer-collector is not the
dependancy for this.

Change-Id: Ie40a99281f1f60de7a409e1e3a2025a850a8a446
2021-11-05 11:27:02 +01:00
Arif Ali f4d772e6a3
Enable pipeline_yaml for mitaka and above
This configuration for pipeline.yaml is still valid for mitaka and
above, so adding this in.

The ceilometer-collector package is not available in newer openstack
releases, so basing this on QUEENS_SERVICES.

This should solve the custom requirement of pipeline moving forward.

Other fixes:
* Update test-requirements.txt for cffi and related pins.
* Update focal-xena bundle to fix memcached series bionic requirement.

Closes-Bug: 1938807
Change-Id: I1946b6f172cdae6f444d07999d5e54d4e11a450e
2021-11-03 13:49:49 +00:00
Arif Ali 6ed691807d
Add meter-sink as an option
If the user wants to add a meter-sink to the pipeline.yaml
at the moment this cannot be done. Previously, pipeline-yaml
config option was allowed and could replace the whole config.

This will now allow to also add meter-sink as an option to
the event_pipeline.yaml, and allow a new source of collecting
all meters, and pushing to the value of meter-sink URLs.

Closes-Bug: 1938807
Change-Id: If6cd82e4153b29c1d8fdb6df150d0d4bb11d4e49
2021-08-12 10:23:38 +01:00
Alex Kavanagh 361eee97f5 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: I824d11bea90e2db8ffba9bfeb22137f150da1c63
2020-09-27 15:27:11 +01:00
Zuul 4f63dbfa6a Merge "Add polling-batch-size config option" 2020-09-17 08:12:03 +00:00
Liam Young e3982a2d98 Fix restart when endpoint notification is received
Restarts were configured only when the ceilometer agent endpoint
had changed and only alarm services were triggered to be restarted.
This change adds a check for the gnocchi service having changed
too and restarts all services to be on the safe side.

Closes-Bug: #1867924
Change-Id: I48e2f079e2db640d485bc74bfc2cedfd7e82ac84
2020-08-20 09:17:58 +00:00
Rodrigo Barbieri 740cac6571 Add polling-batch-size config option
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,
adding the config option to allow its
tuning.

Change-Id: I0e3f756aa0305d3a96e21c7498d6a56208c51007
Closes-bug: #1885190
2020-08-19 18:04:53 +00:00
Erlon R. Cruz de2056f4bf Fix python3 message error
This exception handling code was still calling for
'e.message' which is only present in Python 2 and
not supported anymore. Also fixed unit tests where were
skipping over this.

Closes-bug: #1886874
Change-Id: Ia541e7b8994fae56e04771333009321cd6ac164e
2020-07-10 08:55:20 +00:00
Edward Hope-Morley 2fad29a5ae Ensure agent restart on event_publisher.yaml change
Change-Id: I68bb146399fff4a93cb82701111d73b07a4c1a0b
Closes-Bug: #1880255
2020-07-03 16:54:16 +01:00
Liam Young 7ad2d31417 Set the b64 encoded cert as a string
Sending a byte string to relation-set can result in the data
being sent being prefixed with a "b'". In this case it corrupts
the b64encoding and the receiving charm (ceilometer-agent) cannot
b64decode the data.

Change-Id: I004bff0706362f893f2f69b07568be1034dbf574
2020-05-26 14:48:12 +00:00
Stamatis Katsaounis b66b79378c Update ceilometer-upgrade action
This patch adds debug option to ceilometer-upgrade to be more
explanatory in case of failure. Furthermore, it adds the option of a
sane number of retries because in case of failure at the current
master branch the ceilometer-upgrade action hangs forever.

Change-Id: Ib992eea42c4b085387b19b92798bc88ef0e1589e
Signed-off-by: Stamatis Katsaounis <katsaouniss@gmail.com>
2019-10-24 08:14:39 +00:00
Liam Young 1c5865f4f9 Fix service_name in process_certificates call
Fix service_name when calling process_certificates so it matches
what ApacheSSLContext expects.

Ceilometers Apache config is rendered using
ceilometer_contexts.ApacheSSLContext. This class is a subclass of
charmhelpers.contrib.openstack.context.ApacheSSLContext. The
ceilometer specialised class sets 'service_namespace = "ceilometer"'.
This is then used by parent class to set the destination for certs
and keys to:

ssl_dir = os.path.join('/etc/apache2/ssl/', self.service_namespace)

The code to process incoming certificates from the certificates
relation does something very similar.
charmhelpers.contrib.openstack.cert_utils.process_certificates
takes a service_name parameter. It uses this to set the destination
directory that incoming certificates will be stored in:

ssl_dir = os.path.join('/etc/apache2/ssl/', service_name)

Obviously these two ssl directories need to match. But they do not
because process_certificates is currently called like this:

cert_utils.process_certificates('ceilometer-api', relation_id, unit)

Change-Id: I41a26d00b4d2b22a5cfd2ef38ec76f2efd13f75b
Closes-Bug: #1849292
2019-10-22 11:07:22 +00:00
Dan Ackerson 7b523f82cd Disable haproxy in ocata and beyond
Also take care to remove haproxy in case of upgrades.

Change-Id: I9dfdfc366fb64e50f0209e85072f66998a69f0ac
Closes-Bug: #1773894
2019-07-19 07:45:01 -05:00
Alex Kavanagh 7cc006d262 Convert charm to Python 3
Change-Id: Id2a87f639619ecbdc9e02960e9530133c6816f78
2019-04-24 13:53:55 +01:00
Frode Nordahl 7ca09a1793
Add support for tls-certificates relation
Add support for the charm to request and receive certificates from
the tls-certificates relation.

Add missing direct ``amqp`` relation between ``ceilometer-agent``
and ``rabbitmq-server``

Change-Id: I931f5d3fcbf28e85b1a8e3e7cf24d13cf741e4bd
Closes-Bug: #1818546
2019-03-18 15:07:59 +01:00
David Ames 0a59a19ad2 Use leader set for ceilometer-upgrade checks
The previous attempt at addressing Bug#1811108 was a bit naive.
It was not HA aware and it failed to handle upgrade-charm.

This change moves from kv to leader-set as only the leader needs to run
the action and then inform the other nodes.

Note: on upgrade-charm we must assume the deployment has run
ceilometer-upgrade as there is no mechanism to determine this
independently. If we do not do this, the charm is in blocked state after
charm-upgrade. A warning is logged that this assumption has occurred.

Partial-Bug: #1811108
Change-Id: Idcc26df53542e78f0671942c99edfcbf61eccf6c
2019-02-07 20:23:02 +00:00
Zuul d6e5fd3b04 Merge "Make event_sink publisher configurable" 2019-02-07 10:47:53 +00:00
Edward Hope-Morley d398cdff36 Make event_sink publisher configurable
The charm currently configures events to be published to
rabbit on both the config.event_topic (event.sample queue)
and alarm topic but as of Queens Ceilometer no longer
consumes event.sample. This patch makes the event_sink
publishers configurable and defaults to publishing to
aodh to retain backwards compatibility.

Change-Id: I5b55f31adcf2b069ff51e387a416f9f1ac4099f8
Partial-Bug: #1676586
2019-02-07 10:09:48 +00:00
Zuul cafcec21f0 Merge "Status blocked until ceilometer-upgrade action" 2019-01-30 19:37:22 +00:00
David Ames e2ca8f06de Status blocked until ceilometer-upgrade action
Currently it is unclear that ceilometer is not actually ready when it
is related to gnocchi until the ceilometer-upgrade action has run. The
status will show active Unit is ready when it is not.

When gnocchi is related, check that the ceilometer-upgrade action has
been run. If not set workload status to prompt the administator to run
the action.

Please merge the charm-helpers change first:
https://github.com/juju/charm-helpers/pull/270

Partial-Bug: #1811108
Change-Id: Id778ed3f59e4bcde9c6586aad46be2b5b9ccb531
2019-01-29 23:59:57 +00:00
Edward Hope-Morley 4421c6933e Remove redundant code
Commit 3838010a added code that was subsequently made redundant
by commit 668a2898 but never removed. This patch cleans things
up.

Change-Id: I59fcea6f5bb19e0bc57856600a85a18419cf8730
2019-01-28 14:43:51 +00:00
Zuul 5d9d56add4 Merge "Add polling.yaml to managed configs" 2018-12-11 14:37:32 +00:00
Liam Young 83d47b4b0e Use chelper generate_ha_relation_data for ha rel
Use the generate_ha_relation_data helper from charmhelpers to
generate the data to send down the relation to the hacluster
charm.

This results in a few changes in behaviour:

1) The charm will no longer specify a nic name to bind the vip. This
   is because Pacemaker VIP resources are able to automatically
   detect and configure correct iface and netmask parameters based
   on local configuration of the unit.
2) The original iface named VIP resource will be stopped and deleted
   prior to the creation of the new short hash named VIP resource.

Change-Id: I6c10762e4f3367684f19852d03d5e5b84cf37600
2018-12-04 09:14:42 +00:00
Xav Paice 2baf36f4ee Add polling.yaml to managed configs
This change adds polling.yaml to the list of managed config files, for
Queens and above.  Two new config items are added alongside the
template, to take into account a choice between the two polling.yaml
files supplied with the Ceilometer source, one which has a small list of
pollsters and the other which has all pollsters.  Additionally the
change adds the option to set the polling interval.

Change-Id: Ifff72870cf79bea23dbd21586857dd832c9e1405
Closes-Bug: 1785933
Closes-Bug: 1652848
2018-11-30 15:01:22 +13:00
Liam Young 8cde93e515 Purge old packages on upgrade-charm
On charm upgrade the charm may switch to py3 packages. If so, ensure
the old py2 packages are purged. If the purge occurs then restart
services.

Change-Id: I23812e518d5d0ba64dff33ac8d704b8b0f829b7e
Closes-Bug: 1803451
2018-11-15 13:57:21 +00:00
Ryan Beisner 292bd877d3
Fix lint in unit test
Change-Id: I0921c5508a64e986fe9ad943700276e68fe7e4ba
2018-11-01 14:58:55 -05:00
Liam Young 67b149f89c Support listening to multiple rabbit queues.
This change adds the ability to listen for events across multiple
rabbit queues. Nova cells v2 has a message broker per cell and
the charms already support having a separate message broker for
neutron, in both these topologies ceilometer needs the ability to
listen to multiple brokers.

To achieve this a new relation 'amqp-listener' has been introduced.
The existing 'amqp' relation should be used for the broker that
ceilometer listens to and publishes to. 'amqp-listener' should be
used for additional brokers that ceilometer just listens on.

Update functional tests to satisfy relation with
nova-cloud-controller.

Change-Id: Ifdade3f7814620f4cd4a1d35a584cbc099bb6d88
2018-10-19 07:30:12 +00:00
Felipe Reyes 6d66394482 Add config to manipulate the pipeline.yaml
The configuration file /etc/ceilometer/pipeline.yaml will be managed by
juju, currently it is not. On every change of this file
ceilometer-collector daemon is restarted.

Change-Id: Ie18a5284812f4f698b929b9e17b34289e7732bf7
Closes-Bug: 1715672
2018-09-26 15:27:41 +00:00
Corey Bryant 7cee61a193 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: I120ed44988f9e86a27f464dc879acdc1b8926dd8
2018-09-19 12:54:22 +00:00
Michael Skalka 668a289862 Add support for remote consumers of Ceilometer event data.
There is a use-case to forward events received by ceilometer from
OpenStack services to an external system via http/udp. It comes
from the fact that aodh does not include all information about an
event alarm into POSTed data. Raw event data can be published by
ceilometer via http/udp to an external system without giving a
user direct access to rabbitmq.

This patch adds a context generator, associated templates, and
configuration entry for configuring multiple event-sinks in
/etc/ceilometer/event_pipeline.yaml. This also modifies the
ceilometer.conf templates to reflect the correct naming of the
same file to align with upstream Ceilometer.

Also adds support for a future Panko charm event consumer using
the event-service interface in the above context with associated
metadata and hook symlinks.

This change will only effect Mitaka and later clouds.

Closes Bug: 1763321

Change-Id: I931438c720272bd9a3d2b958ebabcd3584790bd0
2018-05-08 09:50:36 -04:00
David Ames f3148b9bd7 Run ceilometer-upgrade as an action
The ceilometer-upgrade command needs to be run to update back end
ceilometer data stores. When attempting to run this command during
deploy time due to the number of required relations many inherent
race conditions exist leading to Bug#1749280.

This change allows the ceilometer-upgrade command to be run as an action
post-deploy.

Change-Id: I64a56d9a38532476b8a01df6227231a1276c708f
Closes-Bug: #1749280
2018-03-08 14:20:15 +00:00
James Page 3438d424b0 queens: ensure ceilometer-upgrade executed
For queens, only the identity-credentials relation is required
as ceilometer no longer registers endpoints; ensure the correct
relation name is used when checking to see if the ceilometer
upgrade process can be executed.

Change-Id: I8482e97f4f60e019b0225f67c568965adbb034cb
2018-02-23 10:53:39 +00:00
James Page b7a329d456 Align worker configuration option
Align ceilometer charm with worker-multiplier usage as found
across the majority of OpenStack Charms.  Worker configuration
values are set for API, Notification and Collector services
as needed for each release. Note that for Ocata or later, API
services are executed as WSGI apps under Apache which was
already plugged into the standard worker calculation logic
in charm helpers.

This includes dropping of the existing api-worker configuration
option in preference to a calculated approach.

Change-Id: Idba7c3012d9d24b7ae6ef8eade4a5261ef1cbddc
Closes-Bug: #1745189
2018-02-20 13:29:55 +00:00
Ryan Beisner 5d029b7e00 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: I50e8b24c4e9404f81a4b782f414171d5ded31dfb
2018-01-19 16:51:41 +02:00
James Page 4c450fed8c Add support for OpenStack Queens.
Update charm to support Ceilometer@Queens; specifically:

 - Removal of Ceilometer API service
 - Removal of ceilometer-collector service

Most of this change is related to dropping of these
services; In addition its now possible to complete a
ceilometer-upgrade without mongodb being configured.

As this charm no longer provides any endpoints to
keystone, for Queens the identity-credentials relation
is required instead of the identity-service relation.

Change-Id: I3cefc24ffc9a0e60f446fbbdff603dfad37f7baa
2018-01-03 10:40:29 +00:00
Liam Young 24e3599572 Block endpoint reg if cluster partially formed
When an existing cluster of the service is scaled out the new unit
will join with keystone before it is fully clustered. In identity
joined hook the charmhelpers function canonical_url is called which
in turn uses another charmhelpers function, resolve_address.
resolve_address will only return the vip if the vip is set in config
AND the unit is clustered. This means that the units local address
is returned and that is then registered with keystone.

This change gates registering an endpoint if the cluster is
partially formed.

Change-Id: Icf2753b6b21347af8106ebad03d81309177d09f2
Partial-Bug: #1544959
2017-10-06 13:22:40 +00:00
James Page 7165445849 Drop use of openstack OCF resources
The OpenStack OCF resource definitions for Ceilometer have proven
to be quite brittle, and we can achieve much the same end by just
using the lsb module to track ceilometer-agent-central directly.

Drop all use of ocf:openstack and delete res_ceilometer_polling
which is a) broken for Pike and b) complete misnamed.  Configure
'lsb:ceilometer-agent-central' for all deployments irrespective
of release.

Change-Id: I7b02065cf245ae480c04d5db235866e879c14002
Closes-Bug: 1718830
2017-09-25 13:10:23 +01:00
zhangyangyang 124c91e1b3 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: Ib96a90d6e4c4e8c72ddd62820ca794d29f8dbfae
Closes-Bug: #1329757
2017-09-14 09:19:15 +08:00
James Page f778d87ca8 Reset os_release cache during upgrade
Ensure that the os_release cache is cleared during the openstack
upgrade process, ensuring that package list and configuration
options are correctly set for the new OpenStack version.

Change-Id: Ie685854952527f59ee344bfda8e49250c248150a
Closes-Bug: 1715624
2017-09-07 16:55:39 +01:00
James Page 72522a341f Add support for gnocchi
Add new metric-service interface to support use of
Gnocchi as a storage backend for resource and metric
data.

Configure ceilometer to use the gnocchi dispatcher
in the event that ceilometer is related to gnocchi.
This has the side effect of disabling the ceilometer
API - Aodh and Gnocchi API's should be used directly
in this deployment topology.

Note that Gnocchi is only supported in OpenStack
Mitaka or later; 'metrics-service' is added to the
required interfaces configuration as an alternative
to 'mongodb' for >= Mitaka.

Change-Id: Ia31dfefd5efa3fb5ec2ba5d132ee865c567bd8df
2017-08-10 12:57:42 +01:00
Jenkins cf70a3ab26 Merge "Cast time-to-live values to int" 2017-05-15 13:21:42 +00:00
David Ames 232e02f37d Network space aware address for cluster relation
Use the get_relation_ip function for selecting addresses for the
cluster relationship. Including overrides for the admin, internal,
and public config settings or extra bindings.

Partial-Bug: #1687439

Change-Id: I3e651e32a970a427597cc485b8549d51442919cd
2017-05-05 09:49:17 -07:00
Alex Kavanagh 628b106f12 Fix alphanumeric comparisons for openstack and ubuntu releases
- sync charmhelpers with fix-alpha helpers
- fix up code where the alpha comparisons are done
- fix tests which assumed mocks would just work on os_release()

Change-Id: I3d142f04bedc7dde12f3c079534cd43841fa8401
Related-Bug: #1659575
2017-04-26 16:39:26 +01:00
Billy Olsen 09bb38e488 Cast time-to-live values to int
For large integer values, Juju can choose to return the number
in scientific notation. This causes the python code loading the
config data to return a floating point number instead of an
integer. Floating point values in ceilometer's configuration file
will prevent ceilometer from starting.

This change forces the type to an integer, allowing users to
specify large ttl values.

Change-Id: I8e29e6868b4c4a4ae20ad87ab585508fd321261c
Closes-Bug: #1651645
2017-04-13 17:47:43 -07:00
Shane Peters f36d6e5cb1 Set os-network relation data on cluster join
By providing openstack network relation data during cluster join we
allow haproxy backends to be configured in the corresponding os networks
should a 'public-address' not be available.

Change-Id: Ie370552410fffb859d236a011844427d8b3aff45
Closes-Bug: #1669044
2017-03-16 17:53:32 +00:00
Jenkins 9d76c57642 Merge "Run ceilometer-api under mod_wsgi with apache2" 2017-01-18 16:48:23 +00:00