Commit Graph

40 Commits

Author SHA1 Message Date
Aaron Lauterer
3bd128d7a0 ceph pools: allow to create erasure code pools
To use erasure coded (EC) pools for RBD storages, we need two pools. One
regular replicated pool that will hold the RBD omap and other metadata
and the EC pool which will hold the image data.

The coupling happens when an RBD image is created by adding the
--data-pool parameter. This is why we have the 'data-pool' parameter in
the storage configuration.

To follow already established semantics, we will create a 'X-metadata'
and 'X-data' pool. The storage configuration is always added as it is
the only thing that links the two together (besides naming schemes).

Different pg_num defaults are chosen for the replicated metadata pool as
it will not hold a lot of data.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2022-04-28 20:26:38 +02:00
Aaron Lauterer
34a2222dd8 ceph tools: add erasure code management functions
Functions to manage erasure code (EC) profiles:
* add
* remove
* check if exists
* get default prefixed name
* get pool properties
* destroy crush rule

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2022-04-28 20:26:38 +02:00
Thomas Lamprecht
24f3f2bc29 ceph tools: make rados open if not reused shorter
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-28 20:26:38 +02:00
Dominik Csapak
02c1e98e83 pveceph: add 'fs destroy' command
with 'remove-storages' and 'remove-pools' as optional parameters

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2021-11-11 17:52:08 +01:00
Dominik Csapak
0ab69d6e88 api: cephfs: refactor {ls, create}_fs
no function change intended

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2021-11-11 17:52:08 +01:00
Thomas Lamprecht
d380d00008 ceph: code/whitespace cleanups
avoid line bloat, use same capitalization style in warnings as (most)
of the rest of code, some style nits

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-05 08:01:33 +02:00
Thomas Lamprecht
9f6dc0750a ceph: use method to have a single source for install flag file
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-05 08:00:46 +02:00
Aaron Lauterer
4dd27d5034 ceph install: improve ceph install checks during installation
Adding a flag file during the Ceph installation helps to cover the time
span in which the binary is already present but the installation not yet
done.

The most noticeable effect is that the 'Next' button in the GUI will
only become active once the installation is actually finished and not
earlier.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2021-10-05 07:42:57 +02:00
Fabian Ebner
683a3563e7 api: check: create osd: use wipe_blockdev from the Diskmanage package
which is mostly a copy of the wipe_disks helper with the difference
that it also uses wipefs on the device and its partitions.

Remove the wipe_disks helper as no users remain.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-09-30 18:12:58 +02:00
Thomas Lamprecht
68f94af88a ceph: pool set: fix printing problematic settings
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-21 16:06:29 +02:00
Thomas Lamprecht
cb83113ddc ceph: pool set: print settings as they are applied
a bit of a weird place to print code-wise, but it shows up in the
task log just fine.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-21 16:05:42 +02:00
Thomas Lamprecht
69c0ff3e60 ceph: pool set: improve handling "size" parameter
instead of fully duplicating the code just order it first if it
exists...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-21 15:49:43 +02:00
Alwin Antreich
11d7427400 fix: ceph: always set pool size first
Since Ceph Nautilus 14.2.10 and Octopus 15.2.2 the min_size of a pool is
calculated by the size (round(size / 2)). When size is applied after
min_size to the pool, the manual specified min_size will be overwritten.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2021-04-20 18:20:35 +02:00
Stoiko Ivanov
e881cf2a23 ceph: extend error for wrong config-file link
Since I had to look up the cause of the error-message in our source
explaining why exactly ceph-operations fail, because
/etc/ceph/ceph.conf exists.

reported via our community forum:
https://forum.proxmox.com/threads/osd-ersetzen-neu-erstellen.80793/

quickly tested on a virtual ceph cluster

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2020-12-18 17:51:31 +01:00
Thomas Lamprecht
75cac2797f perlcritic fixes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-22 18:18:35 +02:00
Alwin Antreich
50adb13155 ceph: split out pool set into own method
to reduce code duplication and make it easier to add more options for
pool commands.

Use a new rados object for each 'osd pool set', as each command can set
an option independent of the previous commands success/failure. On
failure a new rados object would need to be created and that will
confuse task tracking of the REST environment.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2020-10-22 18:18:35 +02:00
Thomas Lamprecht
fdf79b4e66 ceph: avoid fork/exec overhead for every ceph_cluster_status call
detect heuristically if we need to get the full mon and mgr map extra
for Octopus

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-06-03 15:30:06 +02:00
Alwin Antreich
e25dda254c Make PVE6 compatible with supported ceph versions
Luminous, Nautilus and Octopus. In Octopus the mon_status was dropped.
Also the ceph status was cleaned up and doesn't provide the mgrmap and
monmap.

The rados queries used in the ceph status API endpoints (cluster / node)
were factored out and merged to one place.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2020-06-03 14:23:38 +02:00
Thomas Lamprecht
2a080be165 ceph: get_local_version: allow optional v prefix for version number
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-05-22 18:45:07 +02:00
Alwin Antreich
91dfa228d3 Fix #1210: ceph: extend pveceph purge
to clean service directories as well as disable and stop Ceph services.
Addtionally provide the option to remove crash and log information.

This patch is also in addtion to #2607, as the current cleanup doesn't
allow to re-configure Ceph, without manual steps during purge.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2020-05-06 16:24:46 +02:00
Thomas Lamprecht
52bdf49f20 ceph tools: adapt version to accept -pveX too
this is a precautional measure

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-23 17:59:17 +01:00
Thomas Lamprecht
3248590d53 api: ceph version: actually get full version
add and change the return signature for the wantarray case, which can
safely done as this is only used once (statd), and there only the
first elemen, the full version string, is used - so no breakage
potential there

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-15 18:35:39 +01:00
Thomas Lamprecht
735f24ebae ceph: move possible_flags to Ceph::Tools for intra-module reuse
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-23 15:52:23 +02:00
Thomas Lamprecht
7ef69f338e ceph tools: factor out frequent keyring and config init check
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-23 07:48:45 +02:00
Alwin Antreich
ea60e3b72e keyring: use ckeyring_path variable in chown cmd
A fixed path for the ceph.client.admin.keyring was used in the chown
command. This patch uses the ckeyring_path variable instead, to minimize
changes should the path change.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2019-07-10 15:42:49 +02:00
Alwin Antreich
177095661b Fix: typo in ckeyring_path
pveceph init failed, as the copy used a wrong path with typo as
target and then the chown tried to operate on the correct keyring
path, which was then non-existing.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2019-07-10 15:41:20 +02:00
Fabian Grünbichler
8ba0d0a05e Ceph: add get_cluster_versions helper
to make 'ceph versions' and 'ceph XX versions' accessible.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-06-25 09:03:42 +02:00
Thomas Lamprecht
c18db15ba0 ceph: ensure /etc/ceph belongs to ceph
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-19 17:00:21 +02:00
Thomas Lamprecht
c5a673ed1d ceph: setup symlinks: ensure global ceph config directory exists
normally this gets created on package installation, but could be
deleted, e.g., by a debug purge. As it costs nothing to create just
do a mkdir on it, which does not fails if it already exists..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-18 17:15:07 +02:00
Dominik Csapak
d558d296f7 ceph: mon create: refactor and improve auth key creation
it makes no sense to have the mon key inside the client.admin.keyring
also the order and operations did not make much sense

also create the client admin keyring when creating the config

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-18 17:06:50 +02:00
Dominik Csapak
f8eade23dd ceph: pool destroy: give correct parameter for nautilus
this parameter changed sometime between luminous and nautilus
note that with this change, it is not possible to delete pools in
luminous anymore

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-11 13:47:55 +02:00
Dominik Csapak
d4e7f1bf3d ceph: add db/wal size helper
reads the sizes from the ceph config db first, then from the
ceph config, first from the osd section then global

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-04 17:19:33 +02:00
Thomas Lamprecht
d79e9eb587 followup code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-04 17:18:09 +02:00
Dominik Csapak
48e8a06de1 ceph: add ceph-volume helper
those will be needed for creation/destruction of nautilus osds

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-04 17:16:03 +02:00
Thomas Lamprecht
bba5c71217 ceph: drop systemd_managed - we now always are
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-26 13:35:39 +02:00
Thomas Lamprecht
507b7cfedd fix #2108: ceph: 'osd pools set' cannot accept integers anymore
The new luminous release 12.2.11 cherry-picked a commit[0] which
remove some legacy fallback when parsing a pool set command.
As of now only strings (which itself can then be a string, int or
float) may be passed as a value, while older also accepted an int
directly.

So ensure that all of our "osd pool set" commands pass strings, which
means that 'min_size' and 'size' must be converted to strings before
executing the command.

Without this one cannot create a CephFS over the WebUI anymore as the
create pools fails. Interestingly, the normal create pools over WebUI
still worked, as it has those two parameters exposed in the creation
formular, and thus sents them as string to the backend, while the
cephfs API does not exposes those two values at all but sets them
directly to integers. Funny stuff. CLI invocations also had the same
issue, depending on the fact if size and min_size could and got
passed (then it worked) or where omited (then it did not worked).

[0]: c838a0096d

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-20 19:25:16 +01:00
Alwin Antreich
b436dca874 Fix #2051: preserve DB/WAL disk on destroy
When destroying an OSD over API or CLI, e.g. by executing:

'pveceph osd destroy <num> --cleanup'

all disks associated with the OSD got wiped with dd, which included
any shared and by others still in use ones, e.g., separate disks with
DB/WAL.

The patch changes 'wipe_disks' to wipe the partition instead of the
whole disk.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-08 14:20:23 +01:00
Tim Marx
315304f369 ceph: change check if installed to ceph mon binary
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-01-10 14:53:52 +01:00
Dominik Csapak
27439be616 ceph: move service_cmd and MDS related code to Services.pm
Also adapts the calls to the relevant subs.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-12-20 09:44:01 +01:00
Dominik Csapak
6fb08cb923 ceph: move CephTools into Ceph/Tools.pm
It makes more sense to have it there, especially since we want to
split out the service parts into a seperate file.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-12-20 09:44:01 +01:00