Merge "Improve removal of additional ceph-mon on USM rollback"
This commit is contained in:
commit
4bea98b405
@ -8,7 +8,6 @@ import filecmp
|
|||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import socket
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import software.constants as constants
|
import software.constants as constants
|
||||||
@ -203,23 +202,24 @@ class RemoveCephMonHook(BaseHook):
|
|||||||
"""
|
"""
|
||||||
Remove additional ceph-mon added for each controller
|
Remove additional ceph-mon added for each controller
|
||||||
"""
|
"""
|
||||||
PMON_FILE = "/ostree/1/etc/pmon.d/ceph-fixed-mon.conf"
|
PMON_FILE = "/etc/pmon.d/ceph-fixed-mon.conf"
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
system_type = utils.get_platform_conf("system_type")
|
system_type = utils.get_platform_conf("system_type")
|
||||||
system_mode = utils.get_platform_conf("system_mode")
|
system_mode = utils.get_platform_conf("system_mode")
|
||||||
nodetype = utils.get_platform_conf("nodetype")
|
nodetype = utils.get_platform_conf("nodetype")
|
||||||
hostname = socket.gethostname()
|
|
||||||
# additional monitors were added only for AIO-DX
|
# additional monitors were added only for AIO-DX
|
||||||
if (system_type == constants.SYSTEM_TYPE_ALL_IN_ONE and
|
if (system_type == constants.SYSTEM_TYPE_ALL_IN_ONE and
|
||||||
system_mode != constants.SYSTEM_MODE_SIMPLEX and
|
system_mode != constants.SYSTEM_MODE_SIMPLEX and
|
||||||
nodetype == constants.CONTROLLER):
|
nodetype == constants.CONTROLLER):
|
||||||
cmd = ["ceph", "mon", "rm", hostname]
|
cmd_remove_mon_controller_0 = ["timeout", "30", "ceph", "mon", "rm", "controller-0"]
|
||||||
|
cmd_remove_mon_controller_1 = ["timeout", "30", "ceph", "mon", "rm", "controller-1"]
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(cmd)
|
subprocess.check_call(cmd_remove_mon_controller_0)
|
||||||
LOG.info("Removed mon.%s from ceph cluster." % hostname)
|
subprocess.check_call(cmd_remove_mon_controller_1)
|
||||||
|
LOG.info("Removed mon.controller-0 and mon.controller-1 from ceph cluster.")
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
LOG.exception("Failure removing mon.%s from ceph cluster: %s" % (hostname, str(e)))
|
LOG.exception("Failure removing mon.controller-0 and mon.controller-1 from ceph cluster: %s" % str(e))
|
||||||
raise
|
raise
|
||||||
os.unlink(self.PMON_FILE)
|
os.unlink(self.PMON_FILE)
|
||||||
LOG.info("Removed %s from pmon." % self.PMON_FILE)
|
LOG.info("Removed %s from pmon." % self.PMON_FILE)
|
||||||
|
Loading…
Reference in New Issue
Block a user