Commit Graph

147 Commits

Author SHA1 Message Date
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
Dominik Csapak
c31f487e7a ceph: use cfs_read/write_file for ceph.conf
The parser is now registered, and ceph.conf is a tracked file in pmxcfs.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-12-20 09:44:01 +01:00
Thomas Lamprecht
c56d75b4b6 fixup: whitespace cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-12-13 10:15:46 +01:00
Tim Marx
1aa902ae90 ceph api: added check for /etc/pve/ceph.conf to remaining/new endpoints
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2018-12-13 10:14:39 +01:00
Alwin Antreich
ba454377ad Raise the default pg_num to 128
PGCalc and the ceph recommendation say 128 PGs for up to 5 OSDs

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2018-11-29 12:19:22 +01:00
Thomas Lamprecht
1343ae6db5 fixup: s/wipe_disk/wipe_disks/ as we can to multiple at once
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-28 10:30:58 +01:00
Alwin Antreich
456a7f4d34 Factoring the wipe_disk out into CephTools
Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2018-11-28 10:25:16 +01:00
Thomas Lamprecht
7519b84851 fix #1430: ceph init: allow to specify separate cluster network
Allow to specify a separate cluster network when initializing ceph.
Ceph docs[0] imply a possibility for performance increase and
enhanced security in environments where the public network serves not
fully trusted peers, which could else provoke a DOS to the cluster
traffic[0].

Make this optional, but if passed `network` is required too.

[0]: http://docs.ceph.com/docs/luminous/rados/configuration/network-config-ref/

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-28 09:29:22 +01:00
Thomas Lamprecht
97fe40b0be api/ceph: import file_set_contents
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-23 16:17:13 +01:00
Thomas Lamprecht
7e1a9d25b6 ceph: add CephFS create and list API
Allow to create a new CephFS instance and allow to list them.

As deletion requires coordination between the active MDS and all
standby MDS next in line this needs a bit more work. One could mark
the MDS cluster down and stop the active, that should work but as
destroying is quite a sensible operation, in production not often
needed I deemed it better to document this only, and leaving API
endpoints for this to the future.

For index/list I slightly transform the result of an RADOS `fs ls`
monitor command, this would allow relative easy display of a CephFS
and it's backing metadata and data pools in a GUI.

While for now it's not enabled by default and marked as experimental,
this API is designed to host multiple CephFS instances - we may not
need this at all, but I did not want to limit us early. And anybody
liking to experiment can use it after the respective ceph.conf
settings.

When encountering errors try to rollback. As we verified at the
beginning that we did not reused pools, destroy the ones which we
created.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Co-authored-by: Alwin Antreich <a.antreich@proxmox.com>
2018-11-23 13:33:12 +01:00
Thomas Lamprecht
b82649cc52 ceph: add MDS create/delete/list API
Allow to create, list and destroy and Ceph Metadata Server (MDS) over
the API and the CLI `pveceph` tool.

Besides setting up the local systemd service template and the MDS
data directory we also add a reference to the MDS in the ceph.conf
We note the backing host (node) from the respective MDS and set up a
'mds standby for name' = 'pve' so that the PVE created ones are a
single group. If we decide to add integration for rank/path specific
MDS (possible useful for CephFS with quite a bit of load) then this
may help as a starting point.

On create, check early if a reference already exists in ceph.conf and
abort in that case. If we only see existing data directories later
on we abort but do not remove them, they could well be from an older
manual create - where it's possible dangerous to just remove it. Let
the user handle it themself in that case.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Co-authored-by: Alwin Antreich <a.antreich@proxmox.com>
2018-11-23 13:33:12 +01:00
Thomas Lamprecht
f96d701292 ceph: move create/destroy pool to CephTools
We will reuse this in the future, e.g., when creating a data and
metadata pool for CephFS.

Allow to pass a $rados object (to reuse it, as initializing is not
that cheap) but also create it if it's undefined, fro convenience.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-23 13:33:12 +01:00
Thomas Lamprecht
33a9c70a45 api: document default for ceph service start/stop/restart
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-23 12:40:46 +01:00
Dominik Csapak
342c0830cf ceph: add service restart api call
like start/stop but for restart, this makes maintenance a bit easier

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-11-23 12:23:42 +01:00
Thomas Lamprecht
400742e432 api/Ceph: actually use imported file_{g,s}et_contents 2018-11-22 11:06:12 +01:00
Thomas Lamprecht
0cd34b008b api/Ceph: cleanup module usage
most of this was imported by just copying without verifying if all is
actually required. Some lost its purpose as we re-used more from our
existing module code base (e.g., pve-common) but wasn't actually
removed.

As this file includes two perl modules you need to take a bit caution
when looking at this, as some things are used in one module but not
the other - simple grep'ing at this may give false positives.

Also add PVE::API2::Storage use which was missing here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-22 11:06:12 +01:00
Thomas Lamprecht
d4d2e789b8 api/CephOSD: cleanup and sort module usage
most of this was imported by just copying without verifying if all is
actually required. Some lost its purpose as we re-used more from our
existing module code base (e.g., pve-common) but wasn't actually
removed.

As this file includes two perl modules you need to take a bit caution
when looking at this, as some things are used in one module but not
the other - simple grep'ing at this may give false positives.

Also include the missing IO::File use.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-22 11:06:12 +01:00
Alwin Antreich
6281777bd9 add_storage creates only one ceph storage entry
This patch removes the separate storage entries for CT & VM to the same
ceph pool. Instead only one entry is made as we can now map/unmap
volumes actively in pve-container.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-12 13:22:55 +01:00
Thomas Lamprecht
3e1d7320d0 follow up: cleanup long line
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-10-24 13:24:11 +02:00
David Limbeck
1b3caf4f21 add wipe_disk option when destroying ceph disk
this allows the disk to be reused as ceph disk by zeroing the first 200M
of the destroyed disk. disks are iterated separately from partitions to
prevent duplicate wipes.

Signed-off-by: David Limbeck <d.limbeck@proxmox.com>
2018-10-24 11:46:13 +02:00
Wolfgang Link
29f633a8b1 pveceph: remove 'btrfs' as fstype for new OSDs
btrfs is deprecated since Luminous and it will no more be tested.

If btrfs is used, you have to add an extra parameter to ceph.conf
to allow ceph-disk to activate btrfs OSD's.
In our default config this is not the case.

From Luminous release note [1]:

"We no longer test the FileStore ceph-osd backend in combination with
btrfs. We recommend against using btrfs. If you are using
btrfs-based OSDs and want to upgrade to luminous you will need to
add the follwing to your ceph.conf:

enable experimental unrecoverable data corrupting features = btrfs
The code is mature and unlikely to change, but we are only
continuing to test the Jewel stable branch against btrfs. We
recommend moving these OSDs to FileStore with XFS or BlueStore."

[1] https://ceph.com/releases/v12-2-0-luminous-released/
2018-08-31 08:15:43 +02:00
Fabian Grünbichler
9f4ff79860 pveceph: add missing use statement 2017-11-30 11:31:35 +01:00
Thomas Lamprecht
9aad4e2e79 ceph: create mon: fix & improve check if IP is in public net
If a CIDR gets passed to Net::IP it is expected to not be from the
middle of  an subnet, i.e., 192.168.1.12/24 is *not* OK but
192.168.1.0/24 would be OK.

As the Network/interfaces files also accepts CIDR notation for the
'address' param (now also for IPv4) this let to problems in our node
monitor IP detection code, which used the interface file and Net::IP to
find any address from the ceph public network.

So change to our newer helper PVE::Network::get_local_ip_from_cidr to
get all configured and ready (=up) IPs from this network.

Also handle the case where multiple networks where returned, add a
parameter to allow specifying one of those and ask the user to do so.

If no public network is configured and no mon-address parameter was
passed, we fall back to the remote node IP of the node, as was done
previously. We expect that the user only overwrites the mon-address
if he knows what he do and omit checks here.
2017-11-28 16:46:31 +01:00
Thomas Lamprecht
68f4def420 ceph: create pool: check for quorum at start
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-11-28 16:13:50 +01:00
Alwin Antreich
dae96e48dc Fix: #1542, use percent_used key instead of calculation
Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2017-10-31 08:21:32 +01:00
Dominik Csapak
815a2bc1a7 make bluestore the default on the api
with this we also have to send '0' to from the frontend, when the
bluestore checkbox is not checked

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-10-20 12:01:41 +02:00
Fabian Grünbichler
8ccae777f0 ceph: disable OSD unit in destroyosd
while OSDs units should only be runtime enable and disappear on reboots,
this serves as an additional safeguard to ensure no leftover units can
exist.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-10-10 12:17:17 +02:00
Fabian Grünbichler
f4fe197db4 ceph: correctly parse 'pg dump' output
Reported-By: Waschbüsch IT-Services GmbH <service@waschbuesch.it>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-10-10 12:16:43 +02:00
Dominik Csapak
1fb090840d ceph: do not automatically use wal if only journal is given
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-09-07 12:35:14 +02:00