Commit Graph

175 Commits

Author SHA1 Message Date
Aaron Lauterer
26cf20bc0f api: ceph: add ceph/cfg path, deprecate ceph/config and ceph/configdb
Consolidating the different config paths lets us add more as needed
without polluting our API with too many 'configxxx' endpoints.

The config and configdb paths are renamed under the ceph/cfg path:
* config -> raw (returns the ceph.conf file as is)
* configdb -> db (returns the ceph config db contents)

The old paths are still available and need to be dropped at some point.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by:  Dominik Csapak <d.csapak@proxmox.com>
2023-03-20 15:31:04 +01:00
Aaron Lauterer
b2e005d76a api: ceph: deprecate pools in favor of pool
/nodes/{node}/ceph/pools/{pool} returns the pool details right away on a
GET.  This makes it bad practice to add additional sub API endpoints.

By deprecating it and replacing it with /nodes/{node}/ceph/pool/{pool}
(singular instead of plural) we can turn that into an index GET
response, making it possible to expand it more in the future.

The GET call returning the pool details is moved into
/nodes/{node}/ceph/pool/{pool}/status

The code in the new Pool.pm is basically a copy of Pools.pm to avoid
a close coupling with the old code as it is possible that it will divert
until we can entirely remove the old code.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by:  Dominik Csapak <d.csapak@proxmox.com>
2023-03-20 15:31:04 +01:00
Aaron Lauterer
b62ba85ad7 api: ceph: update return schemas
to include a more complete description of the returned data.
Sort properties in alphabetical order if the list is longer.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2023-01-16 14:32:00 +01:00
Matthias Heiserer
136f5724be API: ceph: fix typo in permissions
With Sys.Audit being spelled wrong, this call always failed

Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
2023-01-13 12:39:40 +01:00
Aaron Lauterer
56b03211e6 api: ceph: sort and update index sub-directory list
The 'cmd-safety', 'configdb' and 'mgr' items were missing, and while
directly calling the API endpoints worked, the api-viewer and pvesh
where partially broken here.

Sort the whole list alphabetically will make it easier to track in
the future

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
 [ T: note which items where missing and reword slightly ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-12-21 14:55:14 +01:00
Aaron Lauterer
f18b7ddd36 api: ceph: fix grammar/styling in descriptions
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
 [ T: slightly rework commit subject ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-12-21 14:50:11 +01:00
Aaron Lauterer
ccb281a7ae api: ceph: add cmd-safety endpoint
Ceph provides us with several safety checks to verify that an action is
safe to perform. This endpoint provides means to acces them.
The actual mon commands are not exposed directly. Instead the two
actions "stop" and "destroy" are offered.

In case it is not okay to perform an action, Ceph provides a status
message explaining why. This message is part of the returned values.

For now there are the following checks for these services:

MON:
  - ok-to-stop
  - ok-to-rm
OSD:
  - ok-to-stop
  - safe-to-destroy
MDS:
  - ok-to-stop

Even though OSDs have a check if it is okay to destroy them, it is for
now not really usable in our workflow because it needs the OSD to be up
and running to return useful information. Our workflow in the GUI
currently is that the OSD needs to be stopped in order to destroy it.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2022-11-17 18:27:48 +01:00
Fabian Ebner
1c6bf641cb api: ceph: remove moved 'flags' calls
living below /cluster/ceph now. Frontend was adapted as part of the move in
commit 1225095df1

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-09 11:29:34 +02:00
Fabian Ebner
337a983cd3 api: ceph: remove obsoleted disks call
replaced by /nodes/{node}/disks/list

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-09 11:29:34 +02:00
Alwin Antreich
56d02a863b api: ceph: subclass pools
for better handling and since the pool endpoints got more entries.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2021-02-06 14:17:53 +01:00
Fabian Ebner
d55b2be9a3 api: Ceph: add reminder to remove 'disks' call
This API call is the predecessor of /nodes/{node}/disks/list, which has seen a
few more improvements. The latter API call should be used instead, and the web
UI already does so.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-02-06 14:04:40 +01:00
Dominik Csapak
063b6d5e0e API2/Ceph: fix createpools 'add_storages' parameter
by deleteing it from $ceph_param we deleted it also from
$param since it was only a reference

fix it by extracting it beforehand

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-11-24 15:45:24 +01:00
Thomas Lamprecht
6d6cf3f802 followup: simplify dropping defaults from common ceph options
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-22 18:18:35 +02:00
Alwin Antreich
c423489a41 ceph: add pg_autoscale_mode to pool create
Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2020-10-22 18:18:35 +02:00
Alwin Antreich
7e03ec643b ceph: use pool common options pool create
to keep the pool create & set in sync.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2020-10-22 18:18:35 +02:00
Alwin Antreich
ba24f026e0 ceph: allow to alter pool settings
after creation, so that users don't need to go the ceph tooling route.
Separate common pool options to reuse them in other places.

Signed-off-by: Alwin Antreich <a.antreich@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
Alwin Antreich
d4dba076a6 ceph: extend pveceph pool ls
to present more data on pools and a nicer formated output on the command
line.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2020-06-03 16:08:27 +02:00
Alwin Antreich
06bd1c5215 ceph: extend the pool view
to add the pg_autoscale_mode since its activated in Ceph Octopus by
default and emmits a waring (ceph status) if a pool has too many PGs.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2020-06-03 16:08:27 +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
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
Dominic Jäger
6e7f4ca63f ceph api: Make systemd unit type suffix optional
To (re)start and stop Ceph services the API calls systemd units using the
function ceph_service_cmd.  If unspecified, this function assumes the type
".target" for a unit. By making the unit type suffix in the API optional, it
can make use of this assumption.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
2020-02-17 13:08:21 +01:00
Thomas Lamprecht
1225095df1 ceph: move flag API endpoints to node-agnostic /cluster/ceph path
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-23 17:15:37 +02: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
3ddccb37ca ceph flags: rename flags2 to flag before public release
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-23 13:59:44 +02:00
Thomas Lamprecht
70f9f9d048 api/ceph: followup: refactor out getting the current set flags
Add a new private helper which just does that for us, to avoid having
the same, or multiple implementations doing the same thing.

Allow to pass the $rados for sharing the same connection but also
just create it else for convenience

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-23 12:54:16 +02:00
Dominik Csapak
5a386ce4eb ceph: set/unset flag: remove unused variable
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-23 10:23:31 +02:00
Dominik Csapak
3139a36e12 ceph: add PUT 'flags' api call
this api call can set multiple flags at once, but does this in a
worker since this can take quiet some time

also we only set/unset flags that are not already set/unset (respectively)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-23 10:23:31 +02:00
Dominik Csapak
eacc058fbc ceph: add GET 'flags2'
we want a GET api call where we return all available flags with
description, but the GET 'flags' api call already returns a string
and not an array, so we cannot use that

instead, we add a new api call that returns that feature and
with e.g. pve 7 we can remove the 'flags' api call and
rename 'flags2' to 'flags'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-23 10:23:31 +02:00
Dominik Csapak
1c898d382a ceph: add flag hash
this is used to generate the paramters for the set/unset api call
and will be used for the parameters of the upcoming 'set multiple flags' call

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-23 07:49:01 +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
Fabian Grünbichler
8e2b5110e5 ceph init: actually die on errors
instead of silently ignoring them

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-07-17 13:01:31 +02:00
Dominik Csapak
21e413dc01 ceph: add api call for config database
simply returns the database content

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-05 09:52:58 +02:00
Fabian Grünbichler
50d5fd6ab0 ceph: init: fix undef var access
Fixes: d851d63ecc
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-07-03 15:10:02 +02:00
Dominik Csapak
d851d63ecc ceph: init: only handle keyring if auth is cephx
if auth is 'none' there is no client keyring, so do not generate it and
do not write it into the config

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-03 11:34:34 +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
3e4c0f06e7 ceph: init: lock ceph config
so that not multiple users can create a ceph cluster at the same time

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-18 16:17:35 +02:00
Dominik Csapak
b3d8b5f527 ceph: init: check for nautilus
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-18 16:17:35 +02:00
Dominik Csapak
52fea280cf ceph: init: update inital config for nautilus
since we do not support creating filestore osds anymore, drop
the journal size from the config

and move the keyring from global to client
this makes it possible to omit the osd keyring path
(which was the default but got overwritten from the global section)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-18 16:17:35 +02:00
Thomas Lamprecht
7618913027 perl: fix some common typos found with codespell
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-15 10:40:20 +02:00
Dominik Csapak
2d7d6c9ac9 ceph: add missing link for 'restart' in ceph api
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-04 14:55:13 +02:00
Tim Marx
410f2cb0c6 api: ceph: ensure calls get proxied to correct node
If calls aren't proxied to the selected node, which seems legit in
 some cases, this will cause some misleading errors while ceph is
 not installed on that node. Therefor the calls should now always get
 proxied.

Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-03-28 14:16:49 +01:00
Thomas Lamprecht
8572111635 api/ceph: allow default value for service start/stop
it's a bit strange that one cannot pass the default value explicitly,
helpfull when calling this API path through the CLI envrionment,
which currently cannot have optional fixed-positioned default values

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-03-25 13:33:07 +01:00
Tim Marx
0cfc685654 check for ceph inited at status api
As this is now the default behavior in all other ceph api endpoints,
I adapted the status api correspondingly.

We also pass our ceph configuration file directly when connecting to
RADOS, so a /etc/ceph/ceph.conf isn't necessarily required to
indicate a fully setup and enabled PVE-ceph environment.

Signed-off-by: Tim Marx <t.marx@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-03-15 14:05:02 +01:00
Dominik Csapak
98fe93ae25 ceph: move Monitor API calls to API2/Ceph/MON.pm
and adapt the paths

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-12-20 09:44:01 +01:00
Dominik Csapak
4fec2764f1 ceph: move MGR API calls to API2/Ceph/MGR.pm
and adapt the paths

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-12-20 09:44:01 +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
79fa41a2b8 ceph: move API2::CephOSD to API2::Ceph::OSD
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