From: Guillaume Abrioux Date: Wed, 10 Jun 2026 11:22:14 +0000 (+0200) Subject: ceph-volume: fix raw activate when device path is stale X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1ee1fc14fe16aee940293ec228107e8c5a68c2d8;p=ceph.git ceph-volume: fix raw activate when device path is stale This changes unlink_bs_symlinks to use os.path.lexists instead of os.path.exists. It can happen that devices get renumbered, in that case, the OSD symlink still exists but its target device is gone which means os.path.exists returns False, so the symlink is never cleaned up and ceph-volume activate can fail later. Fixes: https://tracker.ceph.com/issues/77295 Signed-off-by: Guillaume Abrioux --- diff --git a/src/ceph-volume/ceph_volume/objectstore/baseobjectstore.py b/src/ceph-volume/ceph_volume/objectstore/baseobjectstore.py index 7520f3a05c5..7300644fb3e 100644 --- a/src/ceph-volume/ceph_volume/objectstore/baseobjectstore.py +++ b/src/ceph-volume/ceph_volume/objectstore/baseobjectstore.py @@ -112,7 +112,7 @@ class BaseObjectStore: def unlink_bs_symlinks(self) -> None: for link_name in ['block', 'block.db', 'block.wal']: link_path = os.path.join(self.osd_path, link_name) - if os.path.exists(link_path): + if os.path.lexists(link_path): os.unlink(os.path.join(self.osd_path, link_name)) def prepare_osd_req(self, tmpfs: bool = True) -> None: diff --git a/src/ceph-volume/ceph_volume/tests/objectstore/test_raw.py b/src/ceph-volume/ceph_volume/tests/objectstore/test_raw.py index 2cc365ced5b..e68b68d2ea3 100644 --- a/src/ceph-volume/ceph_volume/tests/objectstore/test_raw.py +++ b/src/ceph-volume/ceph_volume/tests/objectstore/test_raw.py @@ -177,7 +177,7 @@ class TestRaw: @patch('ceph_volume.objectstore.raw.prepare_utils.link_wal') @patch('ceph_volume.objectstore.raw.prepare_utils.link_db') @patch('ceph_volume.objectstore.raw.prepare_utils.link_block') - @patch('os.path.exists') + @patch('os.path.lexists') @patch('os.unlink') @patch('ceph_volume.objectstore.raw.prepare_utils.create_osd_path') @patch('ceph_volume.objectstore.raw.process.run')