Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quincy: ceph-volume/cephadm: support lv devices in inventory #53287

Merged
merged 7 commits into from Sep 15, 2023

Conversation

guits
Copy link
Contributor

@guits guits commented Sep 5, 2023

backport tracker: https://tracker.ceph.com/issues/62707


backport of #52877
parent tracker: https://tracker.ceph.com/issues/62362

this backport was staged using ceph-backport.sh version 16.0.0.6848
find the latest version at https://github.com/ceph/ceph/blob/master/src/script/ceph-backport.sh

this adds `get_lv_path_from_mapper()` and `get_mapper_from_lv_path()`
functions in api.lvm.

they will help translating either an LV path from `/dev/mapper/LV`
to the format `/dev/VG/LV` or the opposite.

Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
(cherry picked from commit c7164df)
LV devices are valid devices, they shouldn't be filtered in
`disk.get_devices()`

Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
(cherry picked from commit 5470a86)
The inventory should report LV devices as they are valid devices that
can be used to be prepared as OSDs.

Fixes: https://tracker.ceph.com/issues/62362

Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
(cherry picked from commit 605da29)
This adds a new config option 'inventory_list_all' so one can make
the command `ceph orch device ls` report lvm devices too as they are
valid devices that can be used to be prepared as OSDs.

Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
(cherry picked from commit e98ec82)
This adds two unit tests in order to cover `test_get_mapper_from_lv_path()`
and `test_get_lv_path_from_mapper()` functions from `api.lvm`

Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
(cherry picked from commit a485883)
This functions works for what it is supposed to do:

check if a device is busy.

That being said, this induces a race condition in `get_devices()`

Indeed, it does:

1/ `os.open()` with `(os.O_RDWR | os.O_EXCL)`
2/ `os.close()`

The second call has an effect: it triggers a udev event which causes
systemd-udevd to re-process the device. This seems to be a question of
millisecond but because of this, /sys (sysfs) isn't fully populated as
expected. Given that get_devices() collects a lot of details from sysfs
in a loop, some of these details can be missed.

ceph-volume overall doesn't make decisions based on `is_locked_raw_device()`
This detail is used only for reporting (inventory).
For this reason, dropping this function seems reasonnable.
As a compromise, we can check if the device has partitions and/or a FileSystem
on it.

Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
(cherry picked from commit 2422ad8)
This makes ceph-volume report partitions in inventory.
A partition is a valid device for `ceph-volume lvm prepare`
so we should report them in inventory (when using `--list-all`
parameter).

Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
(cherry picked from commit 00ba00f)
@guits guits requested review from a team as code owners September 5, 2023 13:27
@guits guits added this to the quincy milestone Sep 5, 2023
@guits guits merged commit dca9b24 into ceph:quincy Sep 15, 2023
11 checks passed
@guits guits deleted the wip-62707-quincy branch September 15, 2023 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants