From 9034ceee7f49175c3b59564c422dd96e4a475d40 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 a2b55ee58..f21241fcf 100644 --- a/library/ceph_volume.py +++ b/library/ceph_volume.py @@ -645,6 +645,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 = ''