Commit Graph

127 Commits

Author SHA1 Message Date
Federico Bosi 2d5663b83c
Don't bind to ipv4 if prefer-ipv6 is true
Following https://tracker.ceph.com/issues/52867 we need to tell the OSD
which address family to use via the ms_bind_ipv4/6 config flags.
I added them to the ceph.conf template and updated the config hook.
Launchpad: https://bugs.launchpad.net/charm-ceph-osd/+bug/2056337

Change-Id: Ifbd59c204a82109e2b71991078f59537f6db42d3
2024-04-10 09:00:15 +02:00
Peter Sabaini 1bac66ee50 Remove FileStore support
Remove support for creating FileStore OSDs. Also prevent upgrade
attempts to Reef if a FileStore OSD is detected

Change-Id: I9609bc0222365cb1f4059312b466a12ef4e0397f
2023-10-06 09:03:51 +02:00
Samuel Walladge ceb8187284 Warn in status if tune-osd-memory-target invalid
This is useful, because if an invalid value is set,
the value is ignored and not overridden,
and an error logged.
So now we warn about this in the status to be more obvious to the user.

Change-Id: Idc4a7706f30cbcea8aee83a1406fa84139fe510d
2023-09-29 13:39:08 +09:30
Samuel Walladge ba6186e5de Add config option for tuning osd memory target
Closes-Bug: #1934143

Depends-On: https://review.opendev.org/c/openstack/charm-ceph-mon/+/869896

Change-Id: I22dfc25c4ac2737f5d872ca2bdab3c533533dbff
2023-08-15 15:16:52 +09:30
Peter Sabaini 22dfd2cc8f Fix pristine status
Only check configured devices instead of all system devices and don't check already processed devices when computing pristine status

Closes-Bug: #1988088
Change-Id: Ia6bf7a5b7abddb72c3ec61fd9e02daf42e94c2da
func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/1025
2023-03-20 20:40:53 +01:00
Samuel Walladge 97be046f9b Save the crash module auth key
Read the key set on the mon relation,
and use ceph-authtool to save it to a keyring,
for use by the crash module for crash reporting.

When this auth key is set, the crash module (enabled by default)
will update ceph-mon with a report.
It also results in a neat summary of recent crashes
that can be viewed by `ceph health detail`.
For example:

```
$ juju ssh ceph-mon/leader -- sudo ceph health detail

HEALTH_WARN 1 daemons have recently crashed
[WRN] RECENT_CRASH: 1 daemons have recently crashed
    osd.1 crashed on host node-3 at 2023-01-04T05:25:18.218628Z
```

ref. https://docs.ceph.com/en/latest/mgr/crash/

See also https://review.opendev.org/c/openstack/charm-ceph-mon/+/869138
for where the client_crash_key relation data set is implemented.

Depends-On: https://review.opendev.org/c/openstack/charm-ceph-mon/+/869138

Closes-Bug: #2000630
Change-Id: I77c84c368e6665e4988ebe9a735f000f99d0b78e
2023-01-20 15:13:13 +10:30
Chris MacNaughton ea56c2c197 Ensure add-disk and hooks handle disks the same way
Depends-On: I2ea119f5a1b2a36ccd36df4db094f208a1db100e
Depends-On: Ie19e5318ea35c38e5d02963260b85fec0f233df6
Change-Id: Idebe45504233fb5559a3e9ddd9b2d6534cba7bb2
Closes-Bug: #1820271
2022-09-12 09:29:05 -04:00
Billy Olsen 82f576ac30 Don't bootstrap osds on mon-relation-departed hook
The charm attempts to bootstrap OSDs on both the mon-relation-changed
and the mon-relation-departed hooks. There is no logical reason that
the OSDs should be bootstrapped in the -departed hook.

Change-Id: I79a790291b0e361d2748d6bed8c989d16ad36daf
Closes-Bug: #1885195
2022-05-13 11:40:39 -07:00
Luciano Lo Giudice 55720fa087 Implement the 'remove-disk' action
This new action allows users to either purge an OSD, or remove it,
opening up the possibility of recycling the previous OSD id. In
addition, this action will clean up any bcache devices that were
created in previous steps.

Change-Id: If3566031ba3f02dac0bc86938dcf9e85a66a66f0
Depends-On: Ib959e81833eb2094d02c7bdd507b1c8b7fbcd3db
func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/683
2022-03-31 18:50:22 +00:00
James Troup 73fe60b3df Spelling fixes from codespell with additional consistency cleanups.
Includes a resync of charms.ceph.

Change-Id: I281fe17acaea826b79bfa902a8d9e7a8b59482a9
2021-12-20 13:21:33 +00:00
Zuul 3cc1cc1b11 Merge "Update get_mon_hosts to not specify mon ports" 2021-06-15 03:29:59 +00:00
Edward Hope-Morley 362e340130 Filter luks devices from pristine checks
update-status needs to account for devices that
are used as bluestore devices where the device
is mapped to a luks dev.

Change-Id: I92e67a5d62eb50dbf5da430d03a6b7ff5485ce46
Closes-Bug: #1929417
2021-05-24 13:33:08 +01:00
Chris MacNaughton 1af3d6f041 Update get_mon_hosts to not specify mon ports
Update get_mon_hosts to avoid specifying the port number for the
MON daemons; we use the default so this is not required, and at
Nautilus the MON daemons run both v1 and v2 messenger ports.

Specifying the port in the ceph.conf file disables the v2
messenger port which is not the desired behaviour on upgrade
or new installation.

Change-Id: I5333cc85f755771733fe09e963d5523fd93c16d2
Closes-Bug: #1917742
2021-03-16 10:38:45 +01:00
Alex Kavanagh f001f5c3d7 Ensure that assess-status hook doesn't error due to vault
The assess-status hook can error out if the vault unit is offline whilst
it is verifying the relation.  This patchset ensures that it simply logs
the error and puts up a warning saying it can't verify the relation.
The state will 'fix itself' when vault comes back online.

Change-Id: I9cb50be5d9d317c48ec3e3ae3ea8fed0687832dd
2020-09-11 17:11:24 +01:00
Frode Nordahl b49468fc10
Add BlueStore Compression support
Sync in updates from charm-helpers and charms.ceph.

Depends-On: I153c22efb952fc38c5e3d36eed5d85c953e695f7
Depends-On: Ibec4e3221387199adbc1a920e130975d7b25343c
Change-Id: I028440002cdd36be13aaee4a0f50c6a0bca7abda
2020-08-26 16:30:24 +02:00
Zuul 300b1bb029 Merge "Warning description for autotune config." 2020-07-17 16:18:03 +00:00
Liam Young ad656e515d Provides unit_name to secrets provider
Pass the unit name to the secrets provider via relation data. The
unit name is not available in CMRs so needs to be passes this way.

Change-Id: I9fa162bbf45144d0827c669fc9b37d7b336366cd
2020-07-11 08:44:17 +00:00
Brett Milford 08d56bb040 Warning description for autotune config.
Change-Id: Ieaccc18a39d018d120ae8bd6ee62b97f30d90e41
Partial-Bug: #1798794
2020-07-10 08:15:03 +10:00
James Page 21ffd9d18b Ensure bootstrapped OSD presented to ceph-mon
On charm upgrade ensure that the number of bootstrapped OSD's
is presented to the ceph-mon application.

This ensures that the ceph-mon application does not switch
into a 'waiting' state after upgrade from earlier versions
of the ceph-* charms.

Change-Id: If1425ef837a74212f002985f648ac1ecf9257201
Closes-Bug: 1861996
2020-06-01 10:41:04 +01:00
Liam Young 3e795f6a62 Apply OSD settings from mons.
Apply OSD settings requested by the mons via the juju relation.
Add the OSD settings to config too. Before applying the settings
config-flags is checked to ensure there is no overlap.

Change-Id: Id69222217a1c99d0269831913abdf488791cb572
2020-05-04 08:23:00 +00:00
Corey Bryant fcfa499f11 Rename lib/ceph to lib/charms_ceph
The new python3-ceph-common deb package (introduced in ceph octopus)
adds a new ceph directory (a parent package in python terms) in
/usr/lib/python3/dist-packages/ceph/. This results in a conflict with
charm-ceph-osd/lib/ceph/. For example, with the current import of
ceph.utils in hooks/ceph_hooks.py, Python finds no utils.py in
/usr/lib/python3/dist-packages/ceph/ and then stops searching.
Therefore, rename lib/ceph to lib/charms_ceph to avoid the conflict.

Depends-On: https://review.opendev.org/#/c/709226
Change-Id: I13ae7c048d8f1eef2ea64b13ae14b51dbfaaf3cd
2020-02-24 15:21:33 +00:00
Edward Hope-Morley d6dc3c794b Charmhelpers sync to get vaultlocker fixes
Also gate checking vault context completing on whether
dependencies are installed.

Change-Id: I6c89944960f592300921fbd455c6d1d8c4b9b2a2
Closes-Bug: #1849323
2019-12-11 14:30:24 +00:00
Chris MacNaughton 23103d2958 Use charm-internal _upgrade_keyring
This change includes a charms.ceph sync.

The _upgrade_keyring function was removed from charms.ceph
so this charm needs to use the already-existing, charm-
internal version.

Change-Id: Ia7cf352a2456dc85aca6f61d2e88327cd0c15f7e
Closes-Bug: #1845975
2019-10-02 15:18:21 +00:00
Chris MacNaughton 82f8bd8804 Refactor OSD bootstrap code out of charms.ceph
As the OSD bootstrap code is unique to ceph-osd, the code
to check / setup the OSD bootstrap & upgrade keys can be
moved in-tree.

Change-Id: Ia1639c81238ca782b5600bbe445cf6ee105bfd37
2019-08-21 15:49:03 +02:00
Felipe Reyes 0a0b9ba316 Fix bdev-enable-discard to honor the documentation
When the user provides an unexpected value in this configuration option
a warning message is logged and the workload is set to blocked.

Closes-Bug: #1835145
Change-Id: I10cac1cf43c11cf11fde196244820ac28b5a47d0
2019-07-03 17:01:16 -04:00
Zachary Zehring 28ca5957b3 Notify ceph-mon relations on version upgrade.
This notification is added to allow ceph-mon to know
when ceph-osd units have upgraded in order to run
post-upgrade commands (required for certain upgrades).

- Add notify_mon_of_upgrade function that sets
ceph_release to release version.

- Refactor some hard coded strings to vars

- Set relation ceph_release when setting bootstrapped-osd

Change-Id: I708b33cafc8818af7e3c63a7fa80c02978e66f65
Partial-Bug: #1828630
2019-05-21 15:30:00 -04:00
Zuul c24c85312a Merge "Clear the non-pristine blocked status" 2019-04-02 11:31:14 +00:00
Zuul 4a3a981e9d Merge "udevadm settle before processing osd-devices" 2019-03-19 07:55:02 +00:00
Chris MacNaughton 4e13ede1da Handle package installs before anything else
Handling other functions of the charm upgrade before possible
new packages leads to breakages when dependencies are unmet

Change-Id: I0e4857d0d03c2d076290a4cc6a08dc1e6d5e1610
Closes-Bug: #1819669
2019-03-12 14:55:53 +01:00
Liam Young 8655dbd9e3 udevadm settle before processing osd-devices
Run udevadm settle before processing osd-devices as there may by
udev events that have been queued for processing on server startup.

Includes charms.ceph sync

Corresponding charms.ceph change is:
Iec5932a4d819ad87e54c2af391abe1befe84f164

Change-Id: Ia4210d6a5c2c8a0b0e2038b25f24d2d82600e10a
Closes-Bug: #1812925
2019-03-05 07:59:46 +00:00
Andre Ruiz 56495eecba Implement new option to enable discard on SSDs
This change implements a new option called 'bdev-enable-discard' to control
behaviour of issuing discards to SSDs on ceph bluestore. The new code tries
to autodetect cases where it should be enabled by default but will allow
forcing if desired.

Change-Id: I7b83605c827eb4058bc4b46c92eb114c11108c93
Closes-Bug: #1788433
2019-03-01 15:26:56 +01:00
Pete Vander Giessen 7b242ebbc3 Don't clobber apparmor profiles.
The charm attempts to avoid restarts of the ceph-osd processes
by asssessing whether new or changed apparmor profiles have
been installed.

The charm always copies apparmor files from the charm to
/etc/apparmor.d which overwrites any local changes made to the
profile - specifically if the profile is in complain mode.

As the content of the profile then changes the restart_on_change
decorator then fires the aa_profile_changed function which
switches the profile back into enforce mode.

This change only overwrites apparmor profiles in the event
that the hash of the source file in the charm changes; if it
does then the current profile mode is re-asserted to ensure
that complain mode deployments don't switch to enforce by
mistake.

Change-Id: I8f8cbf17af6219bd9fbdcf71a7000cba4c63f3f3
Closes-Bug: 1783373
Co-Authored-By: James Page <james.page@ubuntu.com>
2019-02-19 09:29:02 +00:00
Felipe Reyes 336581efeb Update cloud-archive.list when upgrading from Pike to Queens
ceph-osd charm only upgrades when the ceph version changes, for the
case of upgrading from Pike to Queens the charm is skipping any
upgrades, because the Cloud Archive has Luminous for those 2 releases.

This patch checks if the requested ceph version is luminous and if the
'source' changed from pike to queens to then upgrade
/etc/apt/sources.list.d/cloud-archive.list via add_source()

Change-Id: I27c2d7648a1add6528924724a03682060d2d6007
Closes-Bug: 1778823
2019-02-01 11:47:05 -03:00
Alex Kavanagh faefe90ce6 Fix nrpe ceph-osd status respecting permissions
The referenced bug (below) was caused because the nrpe check needed to
access the ceph owned directories, and as the nagios user, nrpe can't.
This change splits the check into a 'collect' phase that runs as root
via a cronjob each minute and writes a file to the tmp directory, and a
nrpe check phase that then reads that file and reports back to nagios.

The 'check' part deletes the 'collect' file, so that fresh information
is available for each nrpe check.  The cron task runs every minute (as
is lightweight), so the nrpe checks should not be sheduled more
frequently than 1 minute.

Change-Id: I4f4594a479eed47cc66643d0c6acece491ae854d
Closes-Bug: #1810749
2019-01-16 12:33:06 +00:00
dongdong tao 03247be719 Clear the non-pristine blocked status
We need to clear the blocked status "non-pristine device detected ..."
when there is no non-pristine device anymore

Change-Id: I2f31eb9c08be186c08554122c2a160bbcbf2c389
Signed-off-by: dongdong tao <dongdong.tao@canonical.com>
Closes-Bug: #1810508
2019-01-07 17:53:09 +08:00
Zuul 021f8b7ca4 Merge "Replace deprecated "decodestring()" by "decodebytes()"" 2018-12-11 14:11:15 +00:00
Zuul 4dea0d6f29 Merge "Support systemd nrpe check for ceph-osd@N units" 2018-12-04 14:56:43 +00:00
Alvaro Uria 11e1dfc565 Support systemd nrpe check for ceph-osd@N units
ceph-osd<->nrpe relation adds a single check that parses the service
status of all the ceph-osd processes. The check supported sysv and
upstart environments, but not systemd, which has been added.

add_init_service_checks does support systemd but it would create a
nrpe check per OSD (vs a single check for all OSDs)

Change-Id: I34fc01365de6994c93a273f01a1e2278016d21ef
Closes-Bug: 1804247
Signed-off-by: Alvaro Uria <alvaro.uria@canonical.com>
2018-11-20 15:52:22 +01:00
James Page 3136669653 Drop use of vaultlocker PPA
vaultlocker is now provided in the UCA and via backports in bionic.

Change-Id: I257b1b2e8aff7900eb0845ea416b54fb42b6b1f5
Closes-Bug: 1802905
2018-11-13 11:36:46 +00:00
Vu Cong Tuan 93690dca8c Replace deprecated "decodestring()" by "decodebytes()"
decodestring() is deprecated alias of decodebytes()
https://docs.python.org/3/library/base64.html#base64.decodestring

The same has been done for nova:
https://review.openstack.org/#/c/610401/

Change-Id: I3be35466fce8d1325cc484b6d2b23f3f818cb08f
2018-11-02 16:15:58 +07:00
Edward Hope-Morley 42c9b7a625 Avoid unnecessary rewrites of ceph.conf
Charm should avoid writing ceph.conf unless it absolutely needs
to since this can clash with other processes that might be
reading the file (such as ceph-disk called by udev).

Change-Id: I3790b5b16fa1473f1c3271b795b3d32c5e8d2fad
Closes-Bug: #1783113
2018-10-29 08:55:56 -06:00
James Page 63f9ac2c7c Notify MON cluster of number of bootstrapped OSD's
To allow the ceph-mon charm to better assess when the Ceph cluster
is in a usable state, provide the number of OSD devices that where
bootstrapped into the Ceph cluster over the relation to ceph-mon.

This is used by the ceph-mon charm inconjunction with the
'expected-osd-count' configuration option to delay pool creation
and issue of keys for clients until the expected number of OSD's
have been bootstrapped into the cluster.

Change-Id: I1370524f0f31120e3cb7305c5bc509a6494c5586
Closes-Bug: 1794878
2018-10-16 09:33:05 +01:00
David Ames a5ab695962 Series Upgrade
Implement the series-upgrade feature allowing to move between Ubuntu
series.

Change-Id: I174c30e0de2c9753742262a31b73651b7a4ed3da
2018-09-21 07:38:01 +00:00
James Page 598c84d21f Don't enable bluestore by default for Jewel
The previous commit to enable bluestore by default incorrectly
used the Jewel version series for the on by default check.

Update this to specify Luminous (12.2.0).

Change-Id: I8e69b171c67e7c0988c2b25f28fc5bac14de1c5e
2018-08-30 08:48:43 +01:00
James Page 8875a7a685 Enable bluestore by default
For Ceph Lumimous (12.2.0) or later enable Bluestore block device
format as the default for Ceph OSD's. Bluestore can be disabled by
setting the bluestore config option to False.

For older releases, Bluestore cannot be enabled as its not
supported - setting the config option will have no effect.

Change-Id: I5ca657b9c4da055c4e0ff12e8b91b39d0964be8c
2018-08-16 05:10:52 +01:00
James Page 488f7dffef Use provided device paths
Ensure that device paths provided by end users are used for OSD's,
rather than the link target device as this may change between
reboots. The specific use case is bcache, where:

   /dev/bcacheX:
        changes between reboots
   /dev/disk/by-dname/bcacheX:
        udev managed and consistent

This change also ensures that any unit data is updated to switch
back to using the provided block device path, rather than the
actual target which may have been used in prior charm revisions.

Change-Id: If5e88d93b9323052ea762d3a4b66f2442d4a19be
Depends-On: If0e1fbc62bfe7d0f9e21db9bfdeee761060de846
Closes-Bug: 1782439
2018-07-27 13:51:55 +01:00
Zuul 81774fe2c0 Merge "Reload OSD when AppArmor policies are changed" 2018-07-19 06:52:33 +00:00
Dmitrii Shcherbakov e340cc851c ignore devices that have already been processed
Similar to how osdize in charms.ceph checks for already processed
devices we need to avoid checking if they are pristine or not.

Additionally, mapped LUKS devices need to be filtered from being zapped
as they may hold valuable data. They are only used as underlying devices
for device mapper and dmcrypt to provide a decrypted block device
abstration so if they really need to be zapped a mapping needs to be
removed first.

This change also pulls charms.ceph modifications.

Change-Id: I96b3d40b3f9e56681be142377e454b15f9e22be3
Co-Authored-By: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
Co-Authored-By: Chris Procter <chris.procter@canonical.com>
Closes-Bug: 1781453
2018-07-17 14:30:51 +03:00
James Page dd42690347 Skip udev rule install in containers
Ensure that udev rules are not installed and reloaded
when running in a container; this is not permitted and
the udev rules are used for block devices, which are
not supported within container based deployments.

Change-Id: I9a580172fcbbf8cec63af7adccb0808915184658
Closes-Bug: 1776713
2018-07-04 04:57:33 +01:00
Frode Nordahl 94b4a52c70
Fix logic error introduced in assess_status()
Commit 352d699387 introduced a change
in assess_status to not update status as long as the previous status
was 'blocked'.  This was done because the check for pristine block
devices is done elsewhere in the charm.

However there are other situations that might set the charm in
'blocked' state.

This commit addresses this error.

Change-Id: Icdc272dadd7f9ceb670d37238628d31f33d11770
2018-06-05 18:32:50 +02:00