Ceph has a function to collect health metrics through smartctl or nvme
command out of the box. And it relies on sudo spawned from the ceph-osd
process so it needs to be considered in the apparmor policy.
[/etc/sudoers.d/ceph-smartctl in ceph-base package]
> ## allow ceph daemons (which run as user ceph) to collect device
> ## health metrics
>
> ceph ALL=NOPASSWD: /usr/sbin/smartctl -x --json=o /dev/*
> ceph ALL=NOPASSWD: /usr/sbin/nvme * smart-log-add --json /dev/*
Also sync charmhelpers and mock platform info
Closes-Bug: #2031637
Change-Id: I981a5db0fd49eca83aa8a619f0cbd0d34a533842
Remove support for creating FileStore OSDs. Also prevent upgrade
attempts to Reef if a FileStore OSD is detected
Change-Id: I9609bc0222365cb1f4059312b466a12ef4e0397f
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
The `ceph osd purge` command used for the remove-disk action can take
several minutes to run. Increase the timeout for this to avoid
spurious errors.
Change-Id: I3a7fafa42c4a2ecaf45ba476e0157937e468ca33
This patchset modifies the add-disk action so that it now
can optionally start a Crimson OSD daemon.
Change-Id: I59bf4e41f1f56c6bda2352b5613289ff73113342
Depends-On: If58bde4d5445ed5de420abc007db6bf8b8e43269
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
As part of the task to improve disk replacement, the 'add-disk' action
needs some changes. This includes:
- Creating 'bcache' devices to accelerate disk access.
- Creating caching partitions of a specified size.
- Recycling previously deactivated OSD ids.
Change-Id: Id5027f30d51c23d2be4c34f82867d65a50b35137
Depends-On: I43d0a0bc11664c37532c0117711affc93c9d1ad1
func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/675
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: Ib658c7f61fe4aceafc1919e366d24ce81ec1dd63
The 'get-availability-zone' action will get information about an
availability zone that will contain information about the CRUSH
structure. Specifically 'rack' and 'row'.
Closes-Bug: #1911006
Change-Id: I99ebbef5f23d6efe3c848b089c7f2b0d26ad0077
When gathering the list of local OSD ids, the charm would consider
the entries under '/var/lib/ceph/osd/ceph-XXX' where 'XXX" was the
OSD id. However, if an entry under that directory isn't mounted,
then the OSD that would represent that entry should be discarded,
as it's no longer active. This patchset thus filters those entries
by looking for them in the mount points.
Closes-Bug: #1934938
Change-Id: I69c6356e450cc0c96de4afe571b438d4a2ea5177
If the disk being zapped is used by lvm (if it contains the
lvm label and hasn't been pvremove'd) it's safer to simply
bail out of zapping it than attempt teardown through a force
pvremove, because the disk being zapped might be in fact in
use by some LV.
Closes-Bug: 1858519
Change-Id: I111475c5a4584a3e367c604ab51ce2ef3789ff7f
The `osds` parameter has been copied from function start/stop to preserve
the same functionality. By default, osd-in/osd-out needs list of IDs as
an argument or it will not do anything (previously, it applied the change
to all the osds). It's possible to take in/out *all* with provided `osds`
parameter as `all`.
Closes-Bug: #1910150
Change-Id: I0275f015e2d0bbbb661d2b7dea59c320ba6c021c
- if the device does not exists, the action failed with message:
'/dev/<device>: Device does not exists.'
Closes-Bug: #1885336
Change-Id: I417c0074fe64c2afceecdfb09b8673930087f65f
Sync in updates from charm-helpers and charms.ceph.
Depends-On: I153c22efb952fc38c5e3d36eed5d85c953e695f7
Depends-On: Ibec4e3221387199adbc1a920e130975d7b25343c
Change-Id: I028440002cdd36be13aaee4a0f50c6a0bca7abda
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
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
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
When we add/zap disks it may change the overall osd
count so need to ensure this is kept up-to-date.
Change-Id: Ib55547f88316e80a8948ce808ea992c1402458f5
Closes-Bug: #1861293
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
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
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
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>
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
The actions pause and resume actually take all osds on a unit out of the
cluster. This is incredibly misleading.
This change renames to osd-out and osd-in to better describe what the
actions actually do.
Change-Id: I76793999f5d3382563eff308a5d7c4db18d065a0
Closes-Bug: #1793507
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
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
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
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
The list of devices provided to the charm is currently incorrectly
parsed such that object names are always limited to 256 chars. This
patch ensures that the expected criteria is met.
Change-Id: Ic5b25af614c77b35484b12dc654df5ac595d9d80
Closes-Bug: 1775029
Add `non-pristine` key to `list-disks` action.
No longer attempt to do initializtion of `osd-journal` devices.
Make py27 test noop
Flip pep8 test to py3
Partial-Bug: #1698154
Change-Id: I0ca574fa7f0683b4e8a693b9f62fbf6b39689789
Depends-On: I90a866aa138d18e4242783c42d4c7c587f696d7d
This action includes configuration for disk(s) to
zap, as well as an additional required flag for
the administrator to acknowledge pending data loss
Change-Id: I3106e2f10cf132a628aad025f73161b04215598e
Related-Bug: #1698154