From 0b8a5838925a65c4c6eaee54c1967e7228b545d3 Mon Sep 17 00:00:00 2001 From: Chris MacNaughton Date: Thu, 25 Aug 2022 14:12:38 -0400 Subject: [PATCH] Fix ceph-osd disk removal on Jammy Closes-Bug: #1987695 Change-Id: I7523e8fa0f6b62329eefcce6daf250881812943c --- actions/remove_disk.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/actions/remove_disk.py b/actions/remove_disk.py index 7a48cba1..7e1cae25 100755 --- a/actions/remove_disk.py +++ b/actions/remove_disk.py @@ -18,6 +18,7 @@ import datetime import errno import json from math import ceil +import os import subprocess import sys import time @@ -240,6 +241,14 @@ class ActionOSD: # Stop the OSD service. hookenv.log('Stopping the OSD service', hookenv.DEBUG) charms_ceph.utils.stop_osd(self.osd_id[4:]) + charms_ceph.utils.disable_osd(self.osd_id[4:]) + unit_filename = \ + '/run/systemd/system/ceph-osd.target.wants/ceph-osd@{}.service' \ + .format(self.osd_id[4:]) + if os.path.exists(unit_filename): + os.remove(unit_filename) + + subprocess.check_call(['systemctl', 'daemon-reload']) # Remove the OSD from the cluster. hookenv.log('Destroying the OSD', hookenv.DEBUG)