From 08a571dc8663027565234ef948ad92d7acacc4fc Mon Sep 17 00:00:00 2001 From: Felipe Sanches Zanoni Date: Mon, 19 Dec 2022 14:35:23 -0500 Subject: [PATCH] Enable ceph init script to use already mounted osd filesystem Ceph initialization script /etc/init.d/ceph was failing to start osd when osd disk is already mounted and the umount fails because disk is in use. The script line has an umount command that fails if the partition is in use. Then, the next mount command will fail returning 32. If the error is that the partition is already mounted, look for 'already mounted on ${fs_path}' text in the output and then ignore the mount error returning success and continuing the start script. An example of error text output: === osd.0 === Mounting xfs on controller-0:/var/lib/ceph/osd/ceph-0 umount: /var/lib/ceph/osd/ceph-0: target is busy. mount: /var/lib/ceph/osd/ceph-0: /dev/nvme2n1p1 already mounted on /var/lib/ceph/osd/ceph-0. failed: 'modprobe xfs ; egrep -q '^[^ ]+ /var/lib/ceph/osd/ceph-0 ' /proc/mounts && umount /var/lib/ceph/osd/ceph-0 ; mount -t xfs -o rw,noatime,inode64,logbufs=8,logbsize=256k /dev/disk/by-path/pci-0000:11:00.0-nvme-1-part1 /var/lib/ceph/osd/ceph-0' Test-Plan: PASS: Validate the new script with partition already mounted on right location in AIO-SX and AIO-DX. PASS: Validate the new script with partition already mounted but on a different location in AIO-SX and AIO-DX. PASS: Validate the new script with partition not mounted in AIO-SX and AIO-DX. Closes-bug: 1999826 Signed-off-by: Felipe Sanches Zanoni Change-Id: I6f0c1a3c2742de62040a690dd3d65785bdc1de73 --- ceph/ceph/debian/deb_folder/ceph-base.ceph.init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ceph/ceph/debian/deb_folder/ceph-base.ceph.init b/ceph/ceph/debian/deb_folder/ceph-base.ceph.init index 80bb233b9..badd1ea9b 100755 --- a/ceph/ceph/debian/deb_folder/ceph-base.ceph.init +++ b/ceph/ceph/debian/deb_folder/ceph-base.ceph.init @@ -913,7 +913,7 @@ for name in $what; do do_root_cmd_okfail "modprobe btrfs ; btrfs device scan || btrfsctl -a ; egrep -q '^[^ ]+ $fs_path ' /proc/mounts && umount $fs_path ; mount -t btrfs $fs_opt $first_dev $fs_path" else echo Mounting $fs_type on $host:$fs_path - do_root_cmd_okfail "modprobe $fs_type ; egrep -q '^[^ ]+ $fs_path ' /proc/mounts && umount $fs_path ; mount -t $fs_type $fs_opt $first_dev $fs_path" + do_root_cmd_okfail "modprobe $fs_type ; egrep -q '^[^ ]+ $fs_path ' /proc/mounts && umount $fs_path ; MOUNT_RESULT=\$(mount -t $fs_type $fs_opt $first_dev $fs_path 2>&1); [ \$? == 0 ] || (echo \$MOUNT_RESULT | grep 'already mounted on ${fs_path}')" fi if [ "$ERR" != "0" ]; then EXIT_STATUS=$ERR