]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: fix raw activate when device path is stale 69410/head
authorGuillaume Abrioux <gabrioux@ibm.com>
Wed, 10 Jun 2026 11:22:14 +0000 (13:22 +0200)
committerGuillaume Abrioux <gabrioux@ibm.com>
Thu, 11 Jun 2026 07:37:10 +0000 (07:37 +0000)
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>
(cherry picked from commit 1ee1fc14fe16aee940293ec228107e8c5a68c2d8)

src/ceph-volume/ceph_volume/objectstore/baseobjectstore.py
src/ceph-volume/ceph_volume/tests/objectstore/test_raw.py

index e9b0ac9d630eda1ab8f9582867afe60a9e71b77c..3b0386a68ef86448548c882c61e6e956eb473c0f 100644 (file)
@@ -110,7 +110,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 ba244d05e18dc82cda4aad3461d94e00a9719f6e..a9de1862a338452a6845ddaeac8a1b6178eb4ab0 100644 (file)
@@ -145,7 +145,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')