From f2304bf8b84a76c5aae4bde6f5f620a81c1b8039 Mon Sep 17 00:00:00 2001 From: Blaine Gardner Date: Mon, 24 Jun 2024 11:34:23 -0600 Subject: [PATCH] osd: fix activate failure when block device moves Block devices can move between reboots. In corner cases, an OSDs block device might move to a lower-indexed device while the previous device does not exist. For example, an OSD on /dev/sde might move to /dev/sdd on reboot if the original /dev/sdd died. There would be no /dev/sde after that. Users report that NVMe drives commonly change names, even when there are no disk failures. For these cases, ensure the activate script properly handles cases where the previous disk is not present on the node and where the OSD is still available on a different disk. Signed-off-by: Blaine Gardner --- pkg/operator/ceph/cluster/osd/spec.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/operator/ceph/cluster/osd/spec.go b/pkg/operator/ceph/cluster/osd/spec.go index a2285f062..bf8066e04 100644 --- a/pkg/operator/ceph/cluster/osd/spec.go +++ b/pkg/operator/ceph/cluster/osd/spec.go @@ -183,7 +183,10 @@ sys.exit('no disk found with OSD ID $OSD_ID') " } - ceph-volume raw list "$DEVICE" > "$OSD_LIST" + if ! ceph-volume raw list "$DEVICE" > "$OSD_LIST"; then + # if the command fails, the disk may be renamed + echo '' > "$OSD_LIST" + fi cat "$OSD_LIST" if ! find_device < "$OSD_LIST"; then