Commit Graph

34 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
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
Hervé Beraud 4cbac58ba1 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: Ib658c7f61fe4aceafc1919e366d24ce81ec1dd63
2021-12-15 09:39:12 +00: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
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
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
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
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
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 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
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
Zuul 1514ea0c3e Merge "Fix osd object name restriction" 2018-06-05 08:14:42 +00:00
Edward Hope-Morley a777297594 Fix osd object name restriction
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
2018-06-04 16:39:51 +01:00
Frode Nordahl 352d699387
Add pre-flight check for device pristinity
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
2018-06-04 17:02:11 +02:00
James Page 2069e620b7 Add support for vault key management with vaultlocker
vaultlocker provides support for storage of encryption keys
for LUKS based dm-crypt device in Hashicorp Vault.

Add support for this key management approach for Ceph
Luminous or later.   Applications will block until vault
has been initialized and unsealed at which point OSD devices
will be prepared and booted into the Ceph cluster.

The dm-crypt layer is placed between the block device
parition and the top level LVM PV used to create VG's
and LV's to support OSD operation.

Vaultlocker enables a systemd unit for each encrypted
block device to perform unlocking during reboots of the
unit; ceph-volume will then detect the new VG/LV's and
boot the ceph-osd processes as required.

Note that vault/vaultlocker usage is only supported with
ceph-volume, which was introduced into the Ubuntu packages
as of the 12.2.4 point release for Luminous.  If vault is
configured as the key manager in deployments using older
versions, a hook error will be thrown with a blocked
status message to this effect.

Change-Id: I713492d1fd8d371439e96f9eae824b4fe7260e47
Depends-On: If73e7bd518a7bc60c2db08e2aa3a93dcfe79c0dd
Depends-On: https://github.com/juju/charm-helpers/pull/159
2018-05-15 08:28:15 +01:00
James Page 35ad3de4f2 ceph-volume: Install charm specific udev rules
Ensure that LV's created using the LVM layout implemented
by this charm are correctly owned by the ceph user and group,
ensuring that ceph-osd processes can start correctly at all
times.

Change-Id: I23ea51e3bffe7207f75782c5f34b796e9eed2c80
Closes-Bug: 1767087
2018-05-09 12:36:00 +01:00
James Page dec2f24ad8 Ensure initial apparmor mode set
Due to changes in the hookenv.config charmhelper, the value of
aa-profile-mode does not change between the install and config-changed
hooks.  This results in the ceph-osd apparmor profile always
being enabled by default (rather than being disabled).

Ensure that an apparmor enforcement mode is correctly set whenever
a new profile is installed - this could either be on first install,
or if a new profile is added to the charm.

Change-Id: I131c9a871ad970b58fa6f41575c240081f653a21
2018-04-25 10:53:37 +01:00
Dmitrii Shcherbakov 189e7620c0 add bluestore-specific config options
Adds bluestore-specific options related to the metadata-only journal.

The options allow a user to control:

1. path to a bluestore wal (block special file or regular file)
2. path to a bluestore db (block special file or regular file)
3. size of both

Their configuration works similarly to the FileStore journal. If paths
are not specified both WAL and DB will be collocated on the same block
device as data.

Other options can be configured via an existing config-flags option if needed.
http://docs.ceph.com/docs/master/rados/configuration/bluestore-config-ref/

Closes-Bug: #1710474
Change-Id: Ia85092230d4dcb0435354deb276012f923547393
Depends-On: I483ee9dae4ce69c71ae06359d0fb96aaa1c56cbc
Depends-On: Idbbb69acec92b2f2efca80691ca73a2030bcf633
2017-12-20 12:02:42 +00:00
James Page c33aa3d15b Avoiding conflicting CRUSH bucket keys
As of Ceph Luminous, bucket keys within the CRUSH map must be
unique; The root bucket is always called 'default' so remap
Juju and configuration provided bucket keys to
'default-{row,rack}' ensuring that keys are unique.

Change-Id: I7fa3dd9e001cca40e678e8983a1d7ed19d51e2fe
Closes-Bug: 1729911
2017-11-17 16:51:23 +00:00
Zuul 7d20f7e37a Merge "Add options for osd backfill pressure" 2017-11-10 14:09:41 +00:00
Frode Nordahl c4d4e42c1a Add actions to blacklist osd-devices
The blacklist actions allow for adding and removing devices
to a unit-local list of devices to be skipped during osd
initialization. This list will be used to override the
application level, and thereby deployment wide, 'osd-devices'
configuration option on a individual unit basis.

The pre-existing list-disk action is extended to return
list of blacklisted devices under the 'blacklist' key.

Change-Id: I28a3c5d6076fb496dead3fe3387d9bbbbe9ec083
Closes-Bug: #1730267
2017-11-09 07:06:29 +01:00
Frode Nordahl e2c41c215c Add unit tests for get_devices and get_journal_devices
Change-Id: I78ea1d1c861070e4d4b1d171ded7286ebb636600
2017-11-07 08:34:14 +01:00
Xav Paice f0de861368 Add options for osd backfill pressure
Added options for osd_max_backfills and osd_recovery_max_active, if we
should want to override the default.

Change-Id: Iaeb93d3068b1fab242acf2d741c36be5f4b29b57
Closes-bug: #1661560
2017-11-07 11:25:53 +13:00
Xav Paice ef3c3c7a0d Add option for OSD initial weight
In small clusters, adding OSDs at their full weight causes massive IO
workload which makes performance unacceptable.  This adds a config
option to change the initial weight, we can set it to 0 or something
small for clusters that would be affected.

Closes-Bug: 1716783
Change-Id: Idadfd565fbda9ffc3952de73c5c58a0dc1dc69c9
2017-09-20 09:28:05 +01:00
Dmitrii Shcherbakov 6c3fe64fb5 use a non-legacy bluestore option on Luminous+
the 'experimental' option is no longer needed as of Luminous release
https://github.com/ceph/ceph/blob/luminous/src/common/legacy_config_opts.h#L79

Change-Id: Idbbb69acec92b2f2efca80691ca73a2030bcf633
2017-08-29 10:20:37 +03:00
James Page ca8a5c332c Add bluestore support for OSD's
Add highly experimental support for bluestore storage format for
OSD devices; this is disabled by default and should only be enabled
in deployments where loss of data does not present a problem!

Change-Id: I21beff9ce535f1b5c16d7f6f51c35126cc7da43e
Depends-On: I36f7aa9d7b96ec5c9eaa7a3a970593f9ca14cb34
2017-07-07 10:00:23 +01:00
Billy Olsen 2c5406b6b3 Upgrade OSDs one at a time when changing ownership
Some upgrade scenarios (hammer->jewel) require that the ownership
of the ceph osd directories are changed from root:root to ceph:ceph.
This patch improves the upgrade experience by upgrading one OSD at
a time as opposed to stopping all services, changing file ownership,
and then restarting all services at once.

This patch makes use of the `setuser match path` directive in the
ceph.conf, which causes the ceph daemon to start as the owner of the
OSD's root directory. This allows the ceph OSDs to continue running
should an unforeseen incident occur as part of this upgrade.

Change-Id: I00fdbe0fd113c56209429341f0a10797e5baee5a
Closes-Bug: #1662591
2017-03-28 12:45:42 -07:00
Chris Holcombe 7d42f6e060 Add support for apparmor security profiles
Install apparmor profile for ceph-osd processes, and provide
associated configuration option to place any ceph-osd processes
into enforce, complain, or disable apparmor profile mode.

As this is the first release of this feature, default to disabled
and allow charm users to test and provide feedback for this
release.

Change-Id: I4524c587ac70de13aa3a0cb912033e6eb44b0403
2016-09-28 09:30:52 +01:00
James Page c32211c8e1 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.

In order to make this change, this commit also drops the
inclusion of upstart configurations for very early versions
of Ceph (argonaut), as they are no longer required.

Change-Id: I9609dd79855b545a2c5adc12b7ac573c6f246d48
2016-06-28 12:01:05 +01:00
Edward Hope-Morley 8f0347d692 Add support for user-provided ceph config
Adds a new config-flags option to the charm that
supports setting a dictionary of ceph configuration
settings that will be applied to ceph.conf.

This implementation supports config sections so that
settings can be applied to any section supported by
the ceph.conf template in the charm.

Change-Id: I306fd138820746c565f8c7cd83d3ffcc388b9735
Closes-Bug: 1522375
2016-06-01 11:31:18 +01:00