Fix ceph-osd disk removal on Jammy

Closes-Bug: #1987695
Change-Id: I7523e8fa0f6b62329eefcce6daf250881812943c
This commit is contained in:
Chris MacNaughton 2022-08-25 14:12:38 -04:00
parent 9fa1b45fe8
commit 0b8a583892

View File

@ -18,6 +18,7 @@ import datetime
import errno import errno
import json import json
from math import ceil from math import ceil
import os
import subprocess import subprocess
import sys import sys
import time import time
@ -240,6 +241,14 @@ class ActionOSD:
# Stop the OSD service. # Stop the OSD service.
hookenv.log('Stopping the OSD service', hookenv.DEBUG) hookenv.log('Stopping the OSD service', hookenv.DEBUG)
charms_ceph.utils.stop_osd(self.osd_id[4:]) 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. # Remove the OSD from the cluster.
hookenv.log('Destroying the OSD', hookenv.DEBUG) hookenv.log('Destroying the OSD', hookenv.DEBUG)