Commit Graph

87 Commits

Author SHA1 Message Date
Alwin Antreich
2184098ed3 Allow setting device class on osd create
In some situations Ceph's auto-detection doesn't recognize the device
class correctly. The option allows to set it directly on osd create,
instead of altering it afterwards. This way the cluster doesn't need to
shift data back and forth unnecessarily.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2020-07-24 10:26:11 +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
Alwin Antreich
485b2cd10a Fix: ceph: mon_address not considered by new MON
The public_addr option for creating a new MON is only valid for manual
startup (since Ceph Jewel) and is just ignored by ceph-mon during setup.
As the MON is started after the creation through systemd without an IP
specified. It is trying to auto-select an IP.

Before this patch the public_addr was only explicitly written to the
ceph.conf if no public_network was set. The mon_address is only needed
in the config on the first start of the MON.

The ceph-mon itself tries to select an IP on the following conditions.
- no public_network or public_addr is in the ceph.conf
    * startup fails

- public_network is in the ceph.conf
    * with a single network, take the first available IP
    * on multiple networks, walk through the list orderly and start on
      the first network where an IP is found

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2020-04-15 09:52:31 +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
Dominik Csapak
a0ef509a66 ceph: do not check ips if no network is configured
the network and the cluster network are optional in the ceph config
and with 'pveceph init', so only check if we have an ip address
from those networks if it is actually configured

otherwise, the createosd call dies with an 'ip' error message
even if it would work

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-03-04 15:38:09 +01:00
Thomas Lamprecht
a05349ab35 followup: add a bit of context to error message
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-16 15:38:50 +01:00
Aaron Lauterer
05bd76ac0e API: OSD: Fix #2496 Check OSD Network
It's possible to have a situation where the cluster network (used for
inter-OSD traffic) is not configured on a node. The OSD can still be
created but can't communicate.

This check will abort the creation if there is no IP within the subnet
of the cluster network present on the node. If there is no dedicated
cluster network the public network is used as a failsafe even though
this situation should not occur.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2019-12-16 15:12:18 +01:00
Alwin Antreich
4a8145e329 ceph: Create symlink on standalone MGR creation
Ceph MGR fails to start when installed on a node without existing
symlink to /etc/pve/ceph.conf.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2019-12-09 14:11:05 +01:00
Thomas Lamprecht
f6b2b1708f api mon: allow full-mesh routed setup for monitor IP
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-26 15:42:24 +01:00
Thomas Lamprecht
a740deff88 fix typos all over the place
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-03 07:55:32 +02:00
Dominik Csapak
385df8382d fix #2341: ceph: osd create: allow db/wal on partioned disks
It was intended that for partitioned disks, we create one and use it.
Instead the code died always when the disk was used and not of type 'LVM'

We now check correctly the 2 cases:
* used for partitions and has gpt
* used and lvm

The remaining api call handles those two cases correctly

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-08-22 14:09:20 +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
Thomas Lamprecht
cead98bd69 api/osd: opinionated code cleanup of list
among others: reduce use of sub-hash as index for another hash

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-22 16:25:07 +02:00
Dominik Csapak
69ad2e539e ceph: osd list: add hostversions to the host nodes
we want to improve the version hints in the osd tree gui and need
the version at the host nodes

we could (and want to) workaround it in the gui to have that
info for both versions of the api call

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-22 15:52:07 +02:00
Thomas Lamprecht
67d8218fbd fix #2292: ceph osd create: use size parameter for db/wal
commit 970f96fdbb did not account for
getting the correct size parameter from the api call, so we ignored
it always resulting in uses not be able to set an explicit db/wal
size

Originally-fixed-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-19 11:05:49 +02:00
Fabian Grünbichler
b4cb37e057 ceph destroymon: actually die on errors
instead of silently ignoring them. since we are in a task worker here
this is especially important - otherwise the task status/result is also
wrong!

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-07-17 13:01:31 +02:00
Thomas Lamprecht
7c9f66d036 followup code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-15 10:57:00 +02:00
Dominik Csapak
199aa9efb7 ceph: mon list: show only as running when monitor is quorate
nautilus puts non running monitors also in the monmap, so only show
as running when it has quorum

this is also not 100% correct, but the only 'correct' alternative is
to try and get/parse the systemd status of the units and broadcast it
to the pmxcfs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-15 10:56:14 +02:00
Thomas Lamprecht
9cc5ac9e75 api/ceph: code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-11 14:16:11 +02:00
Dominik Csapak
b7701301a8 api/ceph: add osd scrub api call
can be called to (deep) scrub a specific osd

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-11 14:16:06 +02:00
Dominik Csapak
351d128f80 ceph: mon create: add known monitor ips to mon_host if it is empty
this fixes an issue where only one monitor is in mon_host, which is
offline, prevents a client connection

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-04 09:57:50 +02:00
Dominik Csapak
217dde83f0 ceph: osd: use get-or-create to create a bootstrap-osd key on demand
if for some reason the cluster does not have this key, generate it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-04 09:57:50 +02:00
Dominik Csapak
7712a4e151 ceph: osd create: check for auth before getting bootstrap key
we do not need it if auth is 'none'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-04 09:57:50 +02:00
Thomas Lamprecht
8ec913c1cc followup: do not use string comparision for integers
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-03 15:34:19 +02:00
Tim Marx
2fb592ddbe api: ceph: automatically create manager after the first monitor
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-07-03 15:34:19 +02:00
Dominik Csapak
b8c37fdae1 ceph: disallow ipv4 in new cluster when ipv6 is enabled
ms_bind_ipv4 is default true and osds look for both
ipv6 and ipv4 addresses in cluster network/public network

since we only allow for one network each (which must be either
ipv4 or ipv6) we disallow ipv4 if ipv6 is detected

this fixes not starting osds on an ipv6 enabled, newly-setup cluster

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-28 15:14:04 +02:00
Dominik Csapak
78f99813bb ceph: mon create: fix not starting monitor if no public_addr is in conf
when there is no 'public_network' in the config, the monitor
can only find an ip if it is given explicitly, either via commandline
(not possible with systemd) or via the ceph.conf

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-28 14:23:23 +02:00
Thomas Lamprecht
790ebc9053 api: ceph mon: add missing perl use statement for Cephconfig
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-19 16:59:26 +02:00
Dominik Csapak
f4d0945862 ceph: mon destroy: do not stop monitor ourselves
a 'mon remove' does this already for us, so do not stop it
this lead to a race where we could stop the next to the last monitor
before it was removed from the cluster, leading to a state
where two monitor were needed for quorum, but only one did exist

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-19 15:26:33 +02:00
Dominik Csapak
ea2ecb0c2f ceph: mon destroy: remove from mon_host
we need to remove an ip, ip:port or a ipvector from monhost
so use multiple regex search and replaces for this

this looks not really nice, but due to the strange format
of the line (e.g. ',' is a seperator inside and outside of a vector,
also ipv6 adresses may be surrounded with [] but so are vectors),
i found no better way

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-19 15:26:33 +02:00
Dominik Csapak
9bc15eea0a ceph: mon destroy: add cfs lock
so that multiple users cannot remove a monitor simultaniously

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-19 15:26:33 +02:00
Dominik Csapak
3babcc1d52 ceph: mon destroy: refactor removal assertions
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-19 15:26:33 +02:00
Dominik Csapak
ad475e25db ceph: mon create: lock monitor creation
otherwise it is possible that multiple users create monitors at the same
time, resulting in a wrong ceph.conf and probably worse

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-19 15:26:33 +02:00
Dominik Csapak
10907e548d ceph: mon create: add to mon_host with msgr2
in nautilus, the default msgr protocol is v2, but it has to be
explicitely given to monmaptool, also we don't want to use the
monitor sections anymore so only update mon_host

ceph can cope with mixed mon_host and monitor sections, so this is
not a problem

also the ceph-create-keys part is not necessary anymore since
this is done by the monitor itself now

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-19 15:26:33 +02:00
Dominik Csapak
db1c4cc8f3 ceph: mon create: refactor mon assertions
by using our new 'get_services_info'

this already checks for nautilus+ style 'mon_host' key in the ceph.conf
for the ip address

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-19 15:26:33 +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
7e32d0bdc4 ceph: mon create: detect pubnet via config database
if we already have a monitor, we can try to get the public_network via
the ceph configuration database

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-18 16:17:35 +02:00
Dominik Csapak
78441ff8da ceph: mon list: make more robust
in a case where we cannot connect to any monitor, we did not get
any info even if we have them via the pmxcfs

so get the RADOS object in an eval, and get the info we have from the
config/pmxcfs, and set the state to unknown if we cannot query via RADOS

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-18 16:17:35 +02:00
Dominik Csapak
4ce045788a ceph: osd create: add encrypted as parameter
uses cpeh-volumes --dmcrypt parameter to encrypt the osd

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-11 12:58:24 +02:00
Thomas Lamprecht
970f96fdbb api osd create: followup code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-06 13:43:32 +02:00
Dominik Csapak
45d45a63cd ceph: make ceph osd create api more readable
The aim of this patch is to reorder/rework the code of the api call
so that it gets more readable

it adds comments of what/why something is done, removes
code duplication between db/wal checks/creation

There are two changes in behaviour:
* when a device is given more than once via the api,
  the user gets a parameter exception for the db or wal
  with the information that the explicit defined devices must be
  different

* we check the usage for db/wal before the worker, so that the user
  gets instant feedback if a device is already in use
  (this is more for api users than for gui users, since we do those
  checks there also)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-06 12:41:14 +02:00
Dominik Csapak
3d7b3992dd ceph: osd create: add missing gpt check
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-05 18:23:49 +02:00
Dominik Csapak
ab62d137e1 ceph: osd create: round size down to the next kib
since the size of an LV can only be a multiple of 512b, we round
down to the next kib

we then have to mulitply it by 1024 for the partition, since
append_partition expects bytes and not kib

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-05 18:23:49 +02:00
Thomas Lamprecht
48983cdb8c api: create mgr: also have id in path for create
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-05 12:41:11 +02:00
Thomas Lamprecht
a91fa58ebd api: mgr create: code cleanup, redue heavy empty line usage
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-05 12:41:11 +02:00
Thomas Lamprecht
a435eaf9a0 api: create mon: also have monid in path for create
similar to the MDS api, so that DELETE and POST calls can operate on
the same path. This does not changes the CLI pveceph interface

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-05 12:41:11 +02:00
Thomas Lamprecht
7760a8beba api: mon create: code cleanup, redue heavy empty line usage
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-05 12:41:11 +02:00
Thomas Lamprecht
6dc136a178 api: ceph mgr list: check if active_name is really set
As in a situation where we /had/ a manager but destroyed it this
key's value is a empty string, and if we pass that to the WebUI we
get strange results form of a ghost MGR entry with ExtJS auto-ID
generation as name -> pretty confusing.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-05 12:41:11 +02:00
Thomas Lamprecht
b32e925587 api: osd destroy: try to remove PVs directly on the fly
no point in first building a list if we can just remove it directly
afterwards, it's eval-ed anyway and $osd_list did not get touched
in-between.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-05 10:50:54 +02:00
Thomas Lamprecht
5ebb945c3c api: osd destroy: pull out cleanup param
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-05 10:49:53 +02:00