From 91167de6741d68d1358db1629cc919b69b9f38a3 Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Fri, 15 May 2020 11:26:31 +0200 Subject: [PATCH] ceph-volume: support for mpath devices Signed-off-by: Jan Fajerski Fixes: https://tracker.ceph.com/issues/45094 (cherry picked from commit ee8887f4c0ff4f91117f31b621b95c8d08019130) --- doc/ceph-volume/lvm/prepare.rst | 28 +++++++++--------------- src/ceph-volume/ceph_volume/util/disk.py | 4 ++-- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/doc/ceph-volume/lvm/prepare.rst b/doc/ceph-volume/lvm/prepare.rst index 3683f6f5b66d7..fd40b7e1e1a89 100644 --- a/doc/ceph-volume/lvm/prepare.rst +++ b/doc/ceph-volume/lvm/prepare.rst @@ -253,28 +253,20 @@ work for both bluestore and filestore OSDs:: ``multipath`` support --------------------- -Devices that come from ``multipath`` are not supported as-is. The tool will -refuse to consume a raw multipath device and will report a message like:: +``multipath`` devices are support if ``lvm`` is configured properly. - --> RuntimeError: Cannot use device (/dev/mapper/). A vg/lv path or an existing device is needed +**Leave it to LVM** -The reason for not supporting multipath is that depending on the type of the -multipath setup, if using an active/passive array as the underlying physical -devices, filters are required in ``lvm.conf`` to exclude the disks that are part of -those underlying devices. +Most Linux distributions should ship their LVM2 package with +``multipath_component_detection = 1`` in the default configuration. With this +setting ``LVM`` ignores any device that is a multipath component and +``ceph-volume`` will accordingly not touch these devices. -It is unfeasible for ceph-volume to understand what type of configuration is -needed for LVM to be able to work in various different multipath scenarios. The -functionality to create the LV for you is merely a (naive) convenience, -anything that involves different settings or configuration must be provided by -a config management system which can then provide VGs and LVs for ceph-volume -to consume. - -This situation will only arise when trying to use the ceph-volume functionality -that creates a volume group and logical volume from a device. If a multipath -device is already a logical volume it *should* work, given that the LVM -configuration is done correctly to avoid issues. +**Using filters** +Should this setting be unavailable, a correct ``filter`` expression must be +provided in ``lvm.conf``. ``ceph-volume`` must not be able to use both the +multipath device and its multipath components. Storing metadata ---------------- diff --git a/src/ceph-volume/ceph_volume/util/disk.py b/src/ceph-volume/ceph_volume/util/disk.py index 3e246ab357d08..329915b32944e 100644 --- a/src/ceph-volume/ceph_volume/util/disk.py +++ b/src/ceph-volume/ceph_volume/util/disk.py @@ -330,7 +330,7 @@ def is_device(dev): # use lsblk first, fall back to using stat TYPE = lsblk(dev).get('TYPE') if TYPE: - return TYPE == 'disk' + return TYPE in ['disk', 'mpath'] # fallback to stat return _stat_is_device(os.lstat(dev).st_mode) @@ -747,7 +747,7 @@ def get_devices(_sys_block_path='/sys/block'): for block in block_devs: devname = os.path.basename(block[0]) diskname = block[1] - if block[2] != 'disk': + if block[2] not in ['disk', 'mpath']: continue sysdir = os.path.join(_sys_block_path, devname) metadata = {} -- 2.39.5