]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: fix raw activate when device path is stale 69391/head
authorGuillaume Abrioux <gabrioux@ibm.com>
Wed, 10 Jun 2026 11:22:14 +0000 (13:22 +0200)
committerGuillaume Abrioux <gabrioux@ibm.com>
Wed, 10 Jun 2026 11:22:14 +0000 (13:22 +0200)
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 <gabrioux@ibm.com>
src/ceph-volume/ceph_volume/objectstore/baseobjectstore.py
src/ceph-volume/ceph_volume/tests/objectstore/test_raw.py

index 7520f3a05c577e20a1de01de86365e26e4e7ef2c..7300644fb3ec49f51f142699d1526926463cdc17 100644 (file)
@@ -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:
index 2cc365ced5bb6ab049f3590fb28ac9ada5290124..e68b68d2ea3efea674b5c4020dec33a9c1a09adf 100644 (file)
@@ -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')