105 Commits

Author SHA1 Message Date
Trent Lloyd
388e96c444 Add identity-credentials relation support
Implement support for the identity-credentials relation as an
alternative way to get keystone credentials when we are not registering
a service endpoint via the identity-service relation.

This solves an issue where the image volume cache does not work when the
cinder volume service is deployed as a second cinder application
('cinder-volume') having enabled-services=volume set.

Previously the following items were missing from cinder.conf:
cinder_internal_tenant_project_id
cinder_internal_tenant_user_id

Resulting in the image cache not functioning with the following warnings:
Unable to get internal tenant context: Missing required config
parameters.
Unable to get Cinder internal context, will not use image-volume cache.

As there are now two possible interfaces to keystone ('identity-service'
and 'identity-credentials') any existing bundles that don't specify the
interface 'identity-service' when relating to keystone will fail to
deploy and will need to be updated.

Closes-Bug: #1978452
Change-Id: Ieef500c9c55eb3968b3e2e231a8ff6e2a5ec148d
(cherry picked from commit ba8d8fc3e10f3ad0cbde08faa52db0f3234b139f)
2023-01-25 11:25:22 +08:00
Corey Bryant
cdc2fc738f Add Kinetic and Zed support
* sync charm-helpers to classic charms
* change openstack-origin/source default to zed
* align testing with zed
* add new zed bundles
* add zed bundles to tests.yaml
* add zed tests to osci.yaml and .zuul.yaml
* update build-on and run-on bases
* add bindep.txt for py310
* sync tox.ini and requirements.txt for ruamel
* use charmcraft_channel 2.0/stable
* drop reactive plugin overrides
* move interface/layer env vars to charmcraft.yaml

Change-Id: Ie133bc41bf789e07d4d777e128617b21d822de30
2022-08-26 18:40:29 +00:00
Alex Kavanagh
7c551e4dfa Migrate charm to charmhub latest/edge track
Change-Id: Ida0ad9ac927de7ed8f9206521014404b38187cd6
Co-authored-by: Aurelien Lourot <aurelien.lourot@canonical.com>
2022-02-01 12:52:13 +01:00
Hervé Beraud
77fdcf3e27 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: I538b5c2a9df4de66c9874e65247496e54c0522e8
2021-12-15 10:56:43 +00:00
Nobuto Murata
bde329d973 Make sure iscsid has a unique InitiatorName
os_brick may require InitiatorName in /etc/iscsi/initiatorname.iscsi
before iscsid is invoked via iscsid.socket with iscsiadm. Cloud images
including MAAS ones have "GenerateName=yes" instead of "InitiatorName="
on purpose not to clone the initiator name. Let's initialize it so
Cinder units can be fully ready to accept iSCSI based subordinate and
storage backend charms.

Closes-Bug: 1825809
Change-Id: I413bbb29dd609e0c86ac3691556f37a9fcc13439
2021-12-01 12:17:49 +09:00
Corey Bryant
bc48c60f1c Drop creation of v2 endpoint from OpenStack Xena+
In this patch we drop creation of the v2 volume endpoint for
OpenStack Xena onward. Upstream cinder removed the block storage
v2 API in commit e05b261a "Remove Block Storage API v2".

func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/670
Depends-On: https://review.opendev.org/c/openstack/charm-cinder/+/816007
Closes-Bug: #1947387
Change-Id: Ie553a53f794f2cdd262bf77364e6374244844b92
2021-11-22 09:18:02 -05:00
Alex Kavanagh
5a3bea35c4 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: I6027b4bb12dce36a7b10df2e14cafd5dc6ee963b
2020-09-28 13:07:05 +01:00
Liam Young
0585d9a96b Do not access DB when it is in maintenance mode.
If the database is in maintenace mode do not attempt to access
it.

Depends-On: I5d8ed7d3935db5568c50f8d585e37a4d0cc6914f
Change-Id: I131079ea390d11c1208f75b8b97ab4cff7fb47ff
2020-01-30 12:35:18 +00:00
Alex Kavanagh
6ee32006e5 Policyd override implementation
This patchset implements policy overrides for cinder.  It uses the
code in charmhelpers.

It also fixes several bugs in the bundles where the actual version of
cinder that was being installed was the distro default rather than the
one that the bundle described.

Change-Id: Ic979dcb96ddb931fadb1fa4a4b36108244ddf306
Closed-Bug: #1741723
2019-10-14 15:11:13 +01:00
James Page
8d977e8152 Ensure identity-joined execute post upgrade.
Re-execute the identity-joined relation to ensure that cinder v3
API endpoints are registered for OpenStack Pike or later.

Change-Id: Ia259696b787188218003f63ab510eb143c0ea563
Closes-Bug: 1809634
2019-03-04 11:56:27 +00:00
Alex Kavanagh
834cde35ec Migrate to python3 only charm
Change-Id: Ia4bcf570d40083625358fdd4fea14202ff3d89af
2019-01-30 12:36:21 +00:00
James Page
a070870967 upgrade-charm: filter previously installed packages
The upgrade-charm hook installs any new packages required for the
new charm version however this needs to be filtered against packages
that are already installed to ensure that any pending package
updates are not installed as a side effect of a charm upgrade.

Change-Id: Ie23b65fd97014134ba6f3d9004f18a4600cd2d5a
Closes-Bug: 1812982
2019-01-23 17:05:00 +00:00
Liam Young
7873b20126 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: I50bddc990cb0182c8ba3a3d473fba2d60186322a
2018-12-03 13:04:34 +00:00
Syed Mohammad Adnan Karim
e6a150c0d2 Update hook to remove old ceph.conf alternatives
When adding ceph-mon relation to cinder, the charm installs ceph.conf
with the update-alternatives via cinder_utils.resource_map().
However when the relation is removed, the alternative isn't cleaned up.
This can cause issues if installing a cinder-ceph subordinate charm.
The cinder-ceph charm also installs a ceph.conf alternative that will
point to the leftover ceph.conf installed by the ceph-mon charm.

Added remove_alternative() in ceph-relation-broken hook to ensure
that leftover ceph.conf alternatives is removed upon relation removal.

Change-Id: If9a8d460ee8209ef917fa55ec970379e9c741ec6
Related-Bug: 1778084
2018-11-26 18:51:36 +00:00
Liam Young
d3ca911e24 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: I3e67d35324888522f6c138ebd74a2ea7f1a4ce05
Closes-Bug: 1803451
2018-11-15 11:33:32 +00:00
Ryan Beisner
8a1009137b
Fix lint in unit tests re: py3-first and py2 compat
Use six for now due to the transitional state of this charm
from py2 to py3.

Change-Id: I24d3cbd66964000600dbcb7849564bb53956fe5c
2018-11-01 21:34:52 -05:00
James Page
3451c1c498 Tidy ceph backend configuration
Drop generation of upstart override file and /etc/environment and
scrub any existing charm configuration in these locations from
an existing install.

These where required way back in the dawn of time when ceph support
was alpha/beta in cinder.

Provide backend specific configuration file path, allowing multiple
ceph clusters to be used with a single cinder application.

Change-Id: I7adba0d35fb7406afa40f047b79a9ab51a6a333d
Closes-Bug: 1769196
2018-05-10 11:51:04 +01:00
James Page
4ea9d6a427 Remove deploy from source support
Drop support for deployment from Git repositories, as deprecated
in the 17.02 charm release.  This feature is unmaintained and has
no known users.

Change-Id: Icd464e950c6f53470311e3c110b530a69bff6e2f
2018-01-12 13:59:33 +00:00
James Page
46f0b43dd3 Drop postgresql support
Remove postgresql DB support; This feature is untested as part
of the charms, is not in use and was deprecated as part of
the 1708 charms release.

Change-Id: I456125442dd721c1b7b48b000fe4b4e4322bb476
2017-12-21 15:11:39 +00:00
Liam Young
1975c41271 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: If483147e17dab8de2883058ee0f2718a3b7f8ca6
Partial-Bug: #1544959
2017-10-06 13:15:53 +00:00
Corey Bryant
d23e6fdf47 Drop v1 API in Pike+
Drop the v1 Cinder API for Pike+ since it is deprecated and no
longer maintained in the upstream code base.

Change-Id: I99e604916f6147b181f45a773c20f3adf2306788
2017-08-07 19:06:53 +00:00
James Page
6a9fc447eb Updates for pike b1
Resync charmhelpers for pike version support.

Add pike tests, but leave disabled until all charms support pike.

Register v3 endpoint for >= pike.

Depends-On: I9a4e452cc7b1b90126d1885c37f5a64b8241479d
Change-Id: I753f1673fe2a9b13ed4a6c3091311f7219490a63
2017-05-12 07:21:30 +02:00
David Ames
3c91613af5 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: I49f8039f069ba51a6eca58949106507d27af5302
2017-05-04 15:55:23 -07:00
David Ames
f5b4750c40 Avoid shared-db change when using access-network
When the percona-cluster charm sets an access-network but the default
unit-get address is not on that network extra shared-db relations get
executed. This is specifically a problem when running upgrades and
trying to avoid API downtime.

The root cause is that the access-network is not checked until the
SharedDBContext is consulted. But then db_joined function will
change it back to the wrong ip on subsequent runs.

This change adds a check for access-network on the relation during
the db_joined function and pushes IP selection off to
get_relation_ip.

Charm helpers sync to pull in changes to get_relation_ip.

Change-Id: I5a78e9dc07c92b54e99e62e00ef6fe505cfa2fdb
Partial-bug: #1677647
2017-04-26 15:20:41 -07:00
Corey Bryant
3d2b097330 Run cinder-api under mod_wsgi with apache2
This change aligns with the Ocata cinder package, which has
moved the cinder-api to run under mod_wsgi with apache2.

Change-Id: I0ce782cdee1f9ab7cc721f346ddfb87067cdc9e7
2017-01-13 20:31:25 +00:00
Jenkins
1babd5054e Merge "Re-license charm as Apache-2.0" 2016-07-01 11:05:48 +00:00
James Page
e02c7cae82 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: I6bf4c1a59778105d81a211b044817cf1041157a2
2016-06-28 12:09:16 +01:00
David Ames
a768342dac DNS HA
Implement DNS high availability. Pass the correct information to
hacluster to register a DNS entry with MAAS 2.0 or greater rather
than using a virtual IP.

Charm-helpers sync to bring in DNS HA helpers

Change-Id: I745271cd85269469b85a9d06fe8af5df8d54ef1c
2016-06-14 16:24:04 -07:00
Andrey Pavlov
4e1acff7e8 Ensure service port is opened for access.
In the case where the cinder service is exposed, Juju needs
to know which ports should be opened. Ensure that the service
port is opened so that remote access can be made in providers
that implement machine fire-walling such as ec2.

Change-Id: I5858569202b03e7edccecb411e540771a16352b0
Closes-Bug: #1585109
2016-05-25 14:29:29 +03:00
James Page
c67fdf10fd Use network space binding for shared-db relation
To ensure that the charm presents the right IP address for
accessing the MySQL database over the shared-db relation,
ensure that any network space binding provided by the user
is preferred over the default of 'private-address'.

If network spaces is not supported (juju < 2.0), fallback to
using 'private-address'.

Change-Id: Ie020135e716cebfbe5f96759a65d5a082b767dd0
2016-04-12 14:56:30 +01:00
Edward Hope-Morley
0bee8428f5 Add hardening support
Add charmhelpers.contrib.hardening and calls to install,
config-changed, upgrade-charm and update-status hooks. Also
add new config option to allow one or more hardening
modules to be applied at runtime.

Change-Id: I69c132b95290faa2cf14accb5e024f98b5aa9c6b
2016-03-31 10:43:24 +01:00
James Page
2dc1572faf Also avoid overwrite of actual endpoint information for service instances where api service is not enabled 2016-01-06 21:24:17 +00:00
James Page
17b74cd527 Rebase 2015-10-29 13:46:01 +09:00
James Page
4f0f555499 Make sure that RESTART_MAP is patched consistently 2015-09-14 14:56:38 +01:00
James Page
0e6f698a7a Tidy, fixup failing tests 2015-09-14 14:21:13 +01:00
Liam Young
d6cc8377e5 [gnuoy, r=hopem] Update ceph broker code to fix Bug #1453940 2015-09-12 07:32:34 +01:00
James Page
434f8c1529 Rebase 2015-09-10 16:56:10 +01:00
Liam Young
f101bbb025 Fix unit tests 2015-09-07 09:34:13 +01:00
David Della Vecchia
52c00c58df Proper merge of trunk. 2015-09-01 16:22:10 +00:00
David Della Vecchia
b6996ee37a merging trunk 2015-09-01 15:20:27 +00:00
David Della Vecchia
55f81f1c06 Normalizing charm config (finally). Adding additional action upgrade config-changed test. 2015-08-31 16:25:22 +00:00
Liam Young
479ad9ba7c Update unit test 2015-08-27 13:38:33 +01:00
Seyeong Kim
789b16856a fix lint error 2015-07-30 16:50:05 +09:00
Seyeong Kim
e60b585cf9 add unit test 2015-07-30 13:00:22 +09:00
Jason Hobbs
395cf28590 Clean up a unit test a bit. 2015-07-22 14:16:31 -05:00
Jason Hobbs
e468f11c96 Add a unit test to cover the config option being loaded. 2015-07-21 14:38:18 -05:00
Jason Hobbs
50368a21f0 Add remove-missing-force config option. 2015-07-21 14:28:23 -05:00
Billy Olsen
c7bcf3d19e Merge with /next 2015-06-10 14:37:05 -07:00
Billy Olsen
54a9b73564 Fix lint error 2015-06-04 16:40:57 -07:00
Billy Olsen
eed60d0821 Change config option to os-public-hostname and lint 2015-06-03 11:21:52 -07:00