From e6b3186420d575c2cb72f84d2c64fbb91cbd2869 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Mon, 19 Oct 2020 10:22:21 +0200 Subject: [PATCH] ceph-volume: refresh lvm metadata cache When running rhel8 containers on a rhel7 host, after zapping an OSD there's a discrepancy with the lvmetad cache that needs to be refreshed. Otherwise, the host still sees the lv and can makes the user confused. If user tries to redeploy an OSD, it will fail because the LV isn't present and need to be recreated. ie: ``` stderr: lsblk: ceph-block-8/block-8: not a block device stderr: blkid: error: ceph-block-8/block-8: No such file or directory stderr: Unknown device, --name=, --path=, or absolute path in /dev/ or /sys expected. usage: ceph-volume lvm prepare [-h] --data DATA [--data-size DATA_SIZE] [--data-slots DATA_SLOTS] [--filestore] [--journal JOURNAL] [--journal-size JOURNAL_SIZE] [--bluestore] [--block.db BLOCK_DB] [--block.db-size BLOCK_DB_SIZE] [--block.db-slots BLOCK_DB_SLOTS] [--block.wal BLOCK_WAL] [--block.wal-size BLOCK_WAL_SIZE] [--block.wal-slots BLOCK_WAL_SLOTS] [--osd-id OSD_ID] [--osd-fsid OSD_FSID] [--cluster-fsid CLUSTER_FSID] [--crush-device-class CRUSH_DEVICE_CLASS] [--dmcrypt] [--no-systemd] ceph-volume lvm prepare: error: Unable to proceed with non-existing device: ceph-block-8/block-8 ``` Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1886534 Signed-off-by: Guillaume Abrioux (cherry picked from commit 0bb106045ee10e08c157134b6e00ab846ce26e1f) --- library/ceph_volume.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/ceph_volume.py b/library/ceph_volume.py index 58100d03d..4c28b2e54 100644 --- a/library/ceph_volume.py +++ b/library/ceph_volume.py @@ -656,6 +656,8 @@ def run_module(): if any(skip) or module.params.get('osd_fsid', None): rc, cmd, out, err = exec_command( module, cmd) + for scan_cmd in ['vgscan', 'lvscan']: + module.run_command([scan_cmd, '--cache']) else: out = 'Skipped, nothing to zap' err = '' -- 2.47.3