Commit Graph

48 Commits

Author SHA1 Message Date
Thomas Lamprecht
51498a2664 ceph: code/indentation cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-03 14:03:32 +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
a11328286a ceph services: cleanup variable names
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-11-22 17:59:36 +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
Alwin Antreich
93bf658986 ceph: remove unused variable assignment
Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2020-04-15 09:52:31 +02:00
Dominik Csapak
0496138e44 ceph: factor out get/broadcast ceph versions to ceph::services
which also removes some dead code
(the my $local_last_version variable was never used)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-04-01 17:15:41 +02:00
Dominik Csapak
7e98f79e40 ceph: make all service name regexes the same
instead of having multiple regexes in various places for the name,
define a 'SERVICE_REGEX' in PVE::Ceph::Services, and use that
everywhere in the api where we need it

additionally limit new sevices to 200 characters, since
systemd units have a limit of 256 characters[0] (including suffix), and
200 seems to be enough.

users can now create ceph services on machines with hostnames
longer than 32 characters

0: https://www.freedesktop.org/software/systemd/man/systemd.unit.html

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-03-04 15:38:09 +01: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
Dominik Csapak
342de4e778 ceph: services: improve addr selection
we map '$type addr' to '$type_addr' anyway in the ceph.conf parser,
so this is not necessary

also use 'public_addr' if it is set

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-04 09:57:50 +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
e7e615768f ceph: services: do not create rados object in get_services_info
we always gave one, and the only reason why it could be undef
is that we could not connect, so it makes no sense to try again
and add unecessary time to the api call

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-18 16:17:35 +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
46fb9c5017 ceph: a little luminous backwards compatibility
ceph luminous does not use the 'name' property in the metadata
everywhere, so fall back to 'id'

this makes the ceph dashboard usable while having still luminous
(relevant for upgrading)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-11 12:58:24 +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
Dominik Csapak
b521573040 ceph: mgr: delete auth key on destruction
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-04 17:07:39 +02:00
Thomas Lamprecht
930c1d6a15 get_cluster_service: do not always call cfs_update
This was done to ensure the nodelist, which get_node_kv uses
internally to loop over all nodes, is filled. But, everything coming
through API/CLI already has a cfs_update called so this is not
required outside from development testing calls. As we normally do
not do this for such calls, cfs_update call is a prerequisite for
such things. The better solution would be handling this internally in
get_node_kv, e.g., by checking if $clinfo->{versionn} was set once,
and if not call to cfs_update, or maybe even better, so adapt the IPC
call for a possibility to get the KV status hash for all nodes.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-04 16:42:37 +02:00
Thomas Lamprecht
9ecb3d10e4 followup code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-04 16:42:37 +02:00
Dominik Csapak
d5373b7dc3 ceph: factor out the service info generation
and include a call to $type metadata to include the version

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-04 14:57:10 +02:00
Dominik Csapak
4e76dbd7b3 ceph: refactor broadcast_ceph_services and get_cluster_service
and use the broadcast when a service is added/removed
we will use 'get_cluster_service' in the future when we generate a list
of services of a specific type

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-04 14:56:24 +02:00
Dominik Csapak
74628668d7 ceph: get_local_services: also check /var/lib/ceph/$type
so we do not miss disabled services

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-04 14:55:45 +02:00
Thomas Lamprecht
ac4f971d18 followup code cleanup for: add get_local_services for ceph
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-27 15:52:12 +02:00
Dominik Csapak
23b20ae451 add get_local_services for ceph
this returns a hash of existing service links for
mds/mgr/mons so that we know which services exists

this is necessary since ceph itself does not save if a service is
defined somewhere, only when it runs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-05-27 15:30:35 +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
be7edba15d ceph: move mgr create/destroy to Ceph::Services
and adapt the paths and callers

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-12-20 09:44:01 +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