Commit Graph

125 Commits

Author SHA1 Message Date
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
Fabian Grünbichler
0a521b6634 ceph/destroypool: move image check into worker
vdisk_list can potentially take very long, and we don't want
the API request to time out.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-09-07 11:38:20 +02:00
Fabian Grünbichler
8c42620460 ceph: make create/destroypool API paths async
in order to get task log entries and easily accessible
task/error logs.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-09-07 11:38:20 +02:00
Fabian Grünbichler
c75f019a55 ceph/destroypool: refactor to use get_storages
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-09-07 11:38:20 +02:00
Fabian Grünbichler
f6144f3493 ceph/destroypool: optionally remove storages
only storages which don't have the 'monhost' option set are removed

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-09-07 11:38:20 +02:00
Fabian Grünbichler
60811ad7eb ceph/createpool: optionally add storages
introduce new API parameter 'add_storages'. if set, one
storage each is configured using the created pool:
- for containers using KRBD
- for VMs using librbd

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-09-07 11:38:20 +02:00
Fabian Grünbichler
0c0d43a7cc ceph: create/destroypool: shorten variable name
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-09-07 11:38:20 +02:00
Fabian Grünbichler
f4aae93bbf ceph: add get_storages helper
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-09-07 11:38:20 +02:00
Fabian Grünbichler
ae672a64ce ceph: add add_storage helper
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-09-07 11:38:20 +02:00
Fabian Grünbichler
e16cd81fb5 pveceph/init: improve version check error message 2017-08-25 14:16:09 +02:00
Alwin Antreich
c64c04dd39 implement checks for ceph version & binaries
add version check to ceph init to require luminous or higher and
fix #1481: check existence of ceph binaries before use

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2017-08-25 13:46:42 +02:00
Dominik Csapak
6c11e92154 ceph: add application parameter to createpool
and use 'rbd' by default, since we cannot create a cephfs or
rgw from the gui currently

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-08-10 09:38:29 +02:00
Dominik Csapak
6747b0a903 ceph: make size 3/min 2 default with createpool
in the gui this is already the default, so make it also the default
in the backend (also 2/1 is really bad as a default)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-08-10 09:38:29 +02:00
Dominik Csapak
4d422ffc3e add bluestore information to osd api call
this adds information about bluestore (which devices and if
bluestore/filestore) to show in the gui

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-08-07 14:52:02 +02:00
Dominik Csapak
c9508b5d4c also get the crush rule name in the ceph pool list
we get the names in the backend, and give them as an additional field
in the api call, and use it in the grid

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-07-31 15:25:34 +02:00
Dominik Csapak
d2692b86e2 fix #1465: use a combobox for the crush rule instead of the id
this patch does a few things

1. we introduce a new api call /nodes/nodename/ceph/rules
   which gets us a list of crush rules

2. we introduce a new CephRuleSelector which is a simple combobox
   with the data from the api call ceph/rules

3. we use this in the create pool window

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-07-31 15:25:34 +02:00
Dominik Csapak
2db28c036e make crush rules working again
since ceph 12.1.1 the (deprecated) parameter 'crush_ruleset' is removed
and replaced with 'crush_rule' while changing this, change from
integer to string so that we can later use the names of the rules
instead of the id

(for now there seems to be a bug that you can only use the name and
not the id)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-07-31 15:25:34 +02:00
Dominik Csapak
33a7e15766 add osd device class to osd tree
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-07-31 15:25:34 +02:00
Dominik Csapak
bb7d5aa955 correctly remove partitions for ceph bluestore osds
we now have to remove 5 types of partitions:

data/metadata
journal
block
block.db
block.wal

this patch fixes the detection of block/block.db/block.wal
generalizes it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-07-31 15:25:34 +02:00
Dominik Csapak
8d64bd8c3b enable using a device for bluestore block db/wal
we reuse the 'journal_dev' parameter for bluestores block.db
and add a new parameter 'wal_dev' for bluestores write ahead log

if only journal_dev is given, use it for both db and wal

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-07-31 15:25:34 +02:00
Dominik Csapak
87eb0fc205 fix creating the first ceph monitor
we cannot use a rados connection before having at least one monitor,
so we have to move it down

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-07-27 15:14:21 +02:00
Dominik Csapak
b0e5ae21cf add missing '-' to service name pattern
since ids can contain '-', we have to include them in the pattern
for the service names

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-07-26 16:51:09 +02:00
Dominik Csapak
be753927e7 whitespace cleanup
and intendation fix

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-07-26 14:45:07 +02:00