From 8a87d43db25a364841d969636bd74b7590c3d563 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 26 Oct 2017 15:09:18 -0400 Subject: [PATCH] ceph-volume lvm.activate remove links on activate before priming Signed-off-by: Alfredo Deza (cherry picked from commit 634b5caaed7c9188e426727e83a0768bdbc51f0d) --- .../ceph_volume/devices/lvm/activate.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/activate.py b/src/ceph-volume/ceph_volume/devices/lvm/activate.py index ceb5c93e9b19b..0a5144ab9551c 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/activate.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/activate.py @@ -95,13 +95,17 @@ def activate_bluestore(lvs): if not system.path_is_mounted(osd_path): # mkdir -p and mount as tmpfs prepare_utils.create_osd_path(osd_id, tmpfs=True) - # if the osd dir was not mounted via tmpfs, it means that the files are - # gone, so it needs to be 'primed' again. The command would otherwise - # fail if the directory was already populated - process.run([ - 'sudo', 'ceph-bluestore-tool', '--cluster=%s' % conf.cluster, - 'prime-osd-dir', '--dev', osd_lv.lv_path, - '--path', osd_path]) + # XXX This needs to be removed once ceph-bluestore-tool can deal with + # symlinks that exist in the osd dir + for link_name in ['block', 'block.db', 'block.wal']: + link_path = os.path.join(osd_path, link_name) + if os.path.exists(link_path): + os.unlink(os.path.join(osd_path, link_name)) + # Once symlinks are removed, the osd dir can be 'primed again. + process.run([ + 'sudo', 'ceph-bluestore-tool', '--cluster=%s' % conf.cluster, + 'prime-osd-dir', '--dev', osd_lv.lv_path, + '--path', osd_path]) # always re-do the symlink regardless if it exists, so that the block, # block.wal, and block.db devices that may have changed can be mapped # correctly every time -- 2.39.5