Commit Graph

715 Commits

Author SHA1 Message Date
James Page cfb228fc43
Fix check for internal endpoint enablement
For cinder volume backend sections, ensure that enabling internal
endpoint usage for service access does not completely clear the
existing content of the section.

Change-Id: I383a0794e924db3c7f4ce47d1e3b88355c2475e4
Closes-Bug: 2052726
2024-02-12 17:14:55 +00:00
Alan Baghumian 59efce8bc8 Restore original paste files if glance-common
re-installation does not restore them.

Implemented a unit test function for the above
scenario.

Call apt_update from upgrade_charm().

Closes-Bug: #2042792

Change-Id: I57c5fa293b421483b0879f24ddac260e47c7cbef
2023-11-08 16:45:21 -08:00
Rafael Lopez 0a1d645000 Add configuration option for custom image properties
Added configuration for injecting default image properties using the
interoperable image import process. This change adds 1 configuration
option to the charm:
- 'custom-import-properties' to specify the desired custom properties

Note: current glance docs example shows incorrect quoting, the
implemented format in this change (no quotes) is correct. Docs fix
in: https://review.opendev.org/c/openstack/glance/+/890423

Release note: https://review.opendev.org/c/openstack/charm-guide/+/891010

Closes-Bug: 1994053
Related-Bug: 2028895
Change-Id: I9548c90e663285c6e7a70eebc8c135a5568974bc
2023-08-10 04:47:17 +00:00
Guillaume Boutry ef5d6de615
Backup glance registry configuration files on upgrade >= Stein
Glance Registry has been deprecated in Stein release.
Leftover configuration files can still be read and
configure wrong settings, breaking deployment.

Closes-Bug: 1979090
Change-Id: I54b72aef0fd49b036cf1783ef9887fa9243c93f8
2023-02-14 08:09:23 +01:00
Gabriel Cocenza 96a2bb3af9 Add support for HAProxy L7 checks
This change add several configuration options to enable HTTP checks
to the HAProxy configuration, instead of the default TCP connection
checks (which continue to be the default)

Closes-Bug: #1880610
Change-Id: I81d7fd67029dd5025f95b41d788b03ce4b6038bb
2023-01-17 18:06:05 -03:00
Corey Bryant 4d29d4792e Ensure openstack-release package is correct after install hook
The linked bug shows the install of the charm with openstack-origin set
to zed.  This happens because configure_installation_source() causes the
openstack-release package to be installed *before* the zed cloud archive
sources are configured into /etc/apt and an apt update done. This means
that the openstack-release package says "yoga" despite the zed packages
actually being installed.

Then, on the config-changed hook, it sees that the installed version is
showing as yoga and tries to do an upgrade.  This fails, as the charm
hasn't yet bootstrapped, and the charm tries to bootstrap after
upgrading the packages.

There's a few bugs here which are exposed, but the tactical fix is to
force the openstack-release to match the installed packages.

Closes-Bug: #1989538
Change-Id: Ic1cf491e1121f4fee3e57862fd1cc0315d3953da
2022-10-04 19:38:18 +00:00
Hemanth Nakkina c2f877a7d4 Add support for cinder storage backend
Create new glance_api.conf template from Ussuri release to
use default_backend and enabled_backends configuration
parameters instead of deprecated stores, default_store
parameters.
Add new config option cinder-volume-types to specify the
volume types in cinder that can be used to store glance
images.
Add logic to update cinder in glance-api configurations
if cinder-volume-service relation is joined.

Also add two flags, cinder_http_retries and
cinder_state_transition_timeout

Closes-Bug: #1905042
Change-Id: Ife649defc9b765b433d7973ab31778f9cb1efdd9
2022-02-07 08:46:14 +05:30
Nobuto Murata cacc3d5a5b Disable expose_image_locations whenever S3 is enabled
This is a follow-up change on Id2e9d4351513341b5ee41fa8a8d677aca6580fca
Instead of relying users to set expose-image-locations=false which is
error prone, disable expose_image_locations from the charm side whenever
S3 backend is enabled not to expose credentials.

Closes-Bug: 1935743
Change-Id: Iac0f27418eec6c818df8cc3fa1c133db38d26069
2021-09-22 22:09:37 +09:00
Nobuto Murata a6dc972b09 Allow enabling S3 object storage backend
S3 backend has been available (again) since Ussuri in the upstream
Glance. We will enable the backend with config options for an external
S3 storage information.

Co-authored-by: Connor Chamberlain <connor.chamberlain@canonical.com>
Co-authored-by: Vladimir Grevtsev <vladimir.grevtsev@canonical.com>
func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/574
Closes-Bug: #1919338
Change-Id: Id76a74cc6041b9c3364399254681138475f19935
2021-06-10 21:26:14 +09:00
Hernan Garcia 4aaa2ce5a3 add config to enable convertion to raw format
image-convertion config enables image convertion to raw format
this optimizes back-end capabilities while not putting the burden
of converting images to their end users

func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/582
Closes-Bug: 1899767
Change-Id: Id3791721f9e38899c87b88591cdc42e46ffea5c1
2021-06-01 05:23:11 -05:00
Ionut Balutoiu 7a69693752 Fix race condition with the object-store relation
The `CONFIGS.write(GLANCE_SWIFT_CONF)` is missing in the object-store
hook. This config file is used when the `swift` backend is enabled.

This bug is only encountered on some deployments, because there are multiple
places where `CONFIGS.write_all()` is called.

If the `object-store` relation is established, and another hook calls
`CONFIGS.write_all()`, this problem wouldn't reproduce. However, if
`object-store` relation is executed last, this issue will pop up.

Closes-Bug: #1915300
Change-Id: Ie52b18fc4dc637dbeec5ecfb8d5930a24c5f72cf
2021-03-19 22:58:47 +00:00
Liam Young 6c6d491280 Waiting state if broker request is incomplete
When assessing the charms status check that the current
ceph broker request has been complete. If it has not
put the charm in a 'waiting' state and update the status
message.

Change-Id: I779b6933242ce88cb1577ae11ca258b96ec46b38
Closes-Bug: #1899918
2020-10-15 14:34:57 +00:00
Liam Young bc273a59e1 Send application name to ceph-mon
Send application name to ceph-mon as ceph-mon cannot derive it from
CMR relations.

Change-Id: I2bd1062b6aa05eab4eb3bd8d602a2d02f085f531
2020-10-01 10:32:35 +00:00
Zuul 6e667242aa Merge "Add multi backend support" 2020-09-24 10:58:09 +00:00
Frode Nordahl 8f3dfb184b
Add Ceph BlueStore Compression support
Func-Test-Pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/398
Change-Id: I997bb15c692c442db2db79d96882a2204186dbe1
2020-09-15 08:35:43 +02:00
Gabriel Adrian Samfira be8c4e00a9 Add multi backend support
Adds multi-backend support to Glance. Currently supported backends
are local, Swift and RBD. The order of preference for default backend
is RBD --> Swift --> Local. Backend can be selected explicitly by the
operator when creating an image.

Change-Id: I78ecad0e8e12fc1ff7d716b7e43d84ca4d5b0ee1
2020-09-14 22:19:22 +00:00
Zuul 40fa7e1469 Merge "Unpin flake8, fix lint" 2020-09-07 14:39:39 +00:00
Zuul e25b09d0ce Merge "Fix misc issues with removal of ceph relation" 2020-09-01 07:53:35 +00:00
Frode Nordahl 65d66ecb58
Unpin flake8, fix lint
Change-Id: Id899936da7721fcc359e63db455a5349603fe559
2020-08-28 16:11:18 +02:00
James Page ed8bdede6f Add support for erasure coded ceph pools
Add standard configuration options for erasure coded pool
creation and profile configuration.

Update ceph relation joined handled to support erasure
coded pools - a replicated pool is created at 1% of the
total data weight alongside the erasure coding profile and
supporting erasure coded data pool.

Update ceph context to use the metadata pool name in the
glance configuration files when erasure-coded pool-type
is configured.

Resync charmhelpers to update Ceph Broker request support
for erasure coding.

Change-Id: If4a31a2adf8080af66885adb970fbb3cdd82f573
Depends-On: Iec4de19f7b39f0b08158d96c5cc1561b40aefa10
2020-08-07 10:41:40 +01:00
James Page 78e7b57854 Fix misc issues with removal of ceph relation
Ensure that services are restarted when the relation is
removed from a model.

Add -departed hook to ensure that ceph.conf is consistent
with monitors in the ceph cluster during scaleback operations.

Change-Id: I2159dd32a49e4591494881bab8469f087a539d5a
Closes-Bug: 1888768
2020-07-24 10:52:17 +01:00
Liam Young 1433f32c3a Make the rbd pool name configurable
Allow the rbd pool name to be set via config. This brings glance
inline with other openstack ceph clients such as cinder.

Change-Id: I93b28c1b1276cca73348fd421024ef3ce0241258
2020-07-11 07:49:32 +00:00
Liam Young eb47ec1147 Stop running register_configs at load time
Stop running register_configs so it is not run unnecessarily.
As part of this make sure that CONFIGS is refreshed after an
upgrade as config files and contexts may have changed.

Closes-Bug: #1879537

Change-Id: Ib5e713194aac7275751329d0bd2dec13ececdf60
2020-05-19 19:10:36 +00:00
Alex Kavanagh 848eb535a4 Remove policy.json from charm for ussuri
Glance (in ussuri) uses policy-in-code, and so that policy.json file
doesn't ship with the package.  This means that the charm can't rely on
the file existing ussuri onwards.  This patchset changes the way the
charm uses policy.json by switching it to a charm determined policy.yaml
file (preferred format) with the only 3 options that the charm
determines to enforce.

Also add yaml vars to focal-ussuri bundle

This brings it into line with the other charms that are part of the the
enable-focal topic.  This makes it easier to add a new bundle just by
changing a couple of variables.

Closes-Bug: #1872996
Change-Id: I47f19272a4e0af3781843608b76304ce8ba1e2b8
2020-04-23 16:17:35 +01:00
Corey Bryant a0f5d548f8 Add minimal policy.json template for Ussuri
As of OpenStack Ussuri, Glance has removed policy.json in favor
of using default policy in code. In order to continue supporting
the restrict-image-location-operations config option, a minimal
policy.json template is rendered for Ussuri and above. This allows
update_image_location_policy() to continue making modifications
to get_image_location, set_image_location, and delete_image_location
policy.

Change-Id: I7e3693ffda01d6a6269e771ecfd232ad2c87ce74
2020-04-01 21:16:38 +00:00
Zuul e54ed63e59 Merge "Disable Apache port 80" 2020-01-31 15:49:43 +00:00
Liam Young 3cdd235144 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: I9550452e78608589592265fca9549a51c88d65bc
2020-01-30 12:38:03 +00:00
tpsilva 8eb305f3f1 Disable Apache port 80
Currently, Apache ports.conf file is not being configured by this
charm. This patch changes the ports.conf default file with another one
that does not open port 80 on SSL environments.

Change-Id: I3f8eb69813058a9291540634ad262bfdaa7b8731
Closes-bug: #1845665
2020-01-28 14:53:01 +00:00
Liam Young 9d60f159e7 When resuming, exclude haproxy
When resuming services exclude those managed by hacluster, in
this case haproxy. If pacemaker lacks quorum it may shut haproxy
down which will cause this charm to error.

Charmhelper sync included to bring in required
get_managed_services_and_ports method.

Change-Id: I9ede7d45e1d4da457d2228caf0367bf374bd51ea
2020-01-25 07:40:22 +00:00
Liam Young fcde1b022b Only run db migration once
This change follows the existing pattern that the keystone charm uses to only
run db migration once. To ensure it only runs once a flag is placed in the
leader db once it has run.

Change-Id: Iaba10cc70f60faa33e00cc5d33e03626f54374f9
2020-01-16 17:51:18 +00:00
Alexandros Soumplis b5e6a3e03a Remove deprecated glance-registry from nrpe checks
This patch removes the deprecated glance-registry service from nrpe
checks after an openstack upgrade to an openstack version greater than
Rocky

Closes-Bug: #1849896
Depends-On: https://github.com/juju/charm-helpers/pull/409

Change-Id: I274441966f15f66341adf30c07c625cc76b2ecb6
Signed-off-by: Alexandros Soumplis <soumplis@admin.grnet.gr>
2020-01-09 16:18:11 +02:00
Zuul 16acb63fcc Merge "Revert "Disable Apache default ports"" 2019-12-20 09:40:34 +00:00
Tiago Pasqualini da Silva bcadb3f450 Revert "Disable Apache default ports"
This reverts commit dcd9a269dc.

Change-Id: I842a67a7e167036ddd7fd529b35ef5d5c03f7c53
2019-12-20 02:05:33 +00:00
Zuul e6d34b0b66 Merge "Disable Apache default ports" 2019-12-19 12:16:29 +00:00
Stamatis Katsaounis 16abd40985 Remove glance-registry in OpenStack Stein deployments
This patch removes glance-registry service when upgrading to
OpenStack Stein and later releases.

Second part of:
Change-Id: Ie6d618582cd5063738a965d36e7d766633e1a607

Change-Id: I5e644ed8dba809fd1ad5d628f32ea64d31799e52
Signed-off-by: Stamatis Katsaounis <skatsaounis@admin.grnet.gr>
2019-11-30 19:49:11 +02:00
tpsilva dcd9a269dc Disable Apache default ports
Openstack services don't use the default ports (80 and 443), so
change Apache to not open them.

Change-Id: I543e3309c5522d7bc865133f8ec5ecc79542112c
Closes-bug: #1845665
2019-11-27 12:51:50 +00:00
Alex Kavanagh 97152f55a1 Policyd override implementation
This patchset implements policy overrides for glance.  It uses the
code in charmhelpers.

Change-Id: I0586326ff87fdf03f2c88e4c459627f4085c3367
Closed-Bug: #1741723
2019-10-07 22:04:00 +01:00
Edward Hope-Morley 160e5d2d9f Ensure glance-registry-paste.ini exists for <= Q
Change-Id: I84360db1522b735a20f4141235b111700935fe58
Closes-Bug: #1812972
2019-05-14 11:28:39 +01:00
Liam Young c9f44a7cec Check Apache ssl dir when determining restart map
If the certificates that Apache is using change then services needs
to be restarted. This change adds the SSL directory to the restart
map to ensure any certificate changes trigger a restart.

Change-Id: Idbdceb5acd80c06a2bde02f9df88a9d9fd2404fb
Closes-Bug: 1828530
2019-05-10 12:48:01 +00:00
Frode Nordahl 37bb5bf8f6
Request appropriate Ceph application name for pools created
Change-Id: I66c7ff150df936a765d753ba0c8eb93631a8da23
2019-03-13 16:13:47 +01:00
Corey Bryant 3d566f7762 Drop glance-registry from restart_map as of stein
This aligns with upstream's removal of glance-registry in the
stein release.

Change-Id: Ie6d618582cd5063738a965d36e7d766633e1a607
2019-02-26 11:18:50 +00:00
Andre Ruiz 6e6b492485 Implement new option: filesystem-store-datadir
This change implements a new option in config.yaml that can be used
to change the location of the images store on the filesystem.

Change-Id: I0d8e7409b8eb4e5e403455db03d73020f741afc4
Closes-Bug: #1657165
2019-02-21 09:41:06 -03:00
Ryan Beisner 8b2c46cff7
Update pre-install hooks to fail on error
The pre-install operations may fail, yet that failure is not
elevated to the user. This masks the failure and makes early
package install issues difficult to troubleshoot.

If the basic pre-install script fails, the charm should not
proceed to later hooks as the requirements may not be met.

Hashbangs for bash should specify -e (errexit) on all of the
pre-install bash scripts.

Change-Id: Iac27d10d928bd0cca60a52564fab4d8082ca1edb
Closes-bug: #1815243
Partial-bug: #1815231
2019-02-08 15:49:35 -06:00
James Page c24e2cf423 upgrade: preserve glance-registry for Queens
The glance-registry daemon was deprecated at Queens, but was still
installed for the Queens charm release; ensure that any re-install
of paste.ini files accomodates this as part of the charm upgrade
process, resolving issues with glance-registry not running due to
missing paste configuration files.

Change-Id: Iaaea4907ce4ef9d1e17b8ef9719e8bb0e0001946
Closes-Bug: 1812972
2019-01-23 16:59:28 +00:00
Przemysław Hausman 046f20f3bc Add support for image_size_cap in charm config
Glance supports image_size_cap setting. This setting controls maximum
size of image a user can upload. An image upload greater than the size
mentioned here would result in an image creation failure.

This commit adds support for setting image_size_cap parameter in charm
config. It can be manipulated during the runtime with `juju config'
command.

Change-Id: I0af1c6a503a87941b7c8ee34255583652e54f0cc
Closes-Bug: #1720040
2018-12-11 23:04:16 +01:00
Liam Young 730fdf716c 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: I0ab095fdcb42dbfd2c64595e7390130500600190
2018-12-04 18:28:11 +00:00
David Ames 178d2701d6 Remove vestigial swift_temp_url_key
The swift-temp-url-key key on the image-service relation seems never to
be consumed (see the ImageService context(s)). It appears to be
vestigial and causes problems like Bug#1804023.

As it is never consumed, this change removes it.

Closes-Bug: #1804023

Change-Id: I2cc19c550ebb1de09e66de8685d507f7db9e0f24
2018-11-27 09:29:46 -08:00
Liam Young 9ddaa45565 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 restore
the glance-api-paste.ini from packages and restart services.

Closes-Bug: 1803451
Change-Id: Ib258873fb2be95821e8f8c22fd1f3d19666b3181
2018-11-15 11:03:14 +00:00
Corey Bryant 471e648830 py3: Don't purge python-six and fix purge ret val
python-six is also used by crmsh in HA deployment so don't purge it
on OpenStack upgrade or we lose the ability to manage the corosync/
pacemaker cluster.

Also ensure non-empty package list is returned for rocky+ in
determine_purge_packages.

Change-Id: Ia614ec0f9dce907952cab32db2725abe47ef404e
2018-10-15 13:28:46 -04:00
James Page 6001f58a48 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
installed and then autoremove --purge any dependencies that are
no longer required.

Tidy install on ceph relation joined - python-ceph is a dependency
of ceph-common, so no need to explicitly install.

Change-Id: I7b66bb3ab9f9130c9054411819d51434480cac97
2018-09-21 16:28:48 +02:00