Skip to content

Commit

Permalink
suites: add host thrasher
Browse files Browse the repository at this point in the history
To simulate real world maintanace, we will usualy shut down hosts and not just osd
the following commit will add host thrasher option to Thraser, when thrash_hosts
is True we won't thrash osds one by one, we will choose entire host and thrash all
the osds under that host.

Signed-off-by: Nitzan Mordechai <nmordech@redhat.com>
  • Loading branch information
NitzanMordhai committed Feb 28, 2024
1 parent b8ae42d commit 190a761
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion qa/tasks/ceph_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,25 @@ def revive_osd(self, osd=None, skip_admin_check=False):
self.ceph_manager.set_config(self.rerrosd,
bluestore_debug_random_read_err = self.random_eio)

def out_host(self, host=None):
"""
Make all osds on a host out
:param host: Host to be marked.
"""
# check that all osd remotes have a valid console
osds = self.ceph_manager.ctx.cluster.only(teuthology.is_type('osd', self.ceph_manager.cluster))
if host is None:
host = random.choice(list(osds.remotes.keys()))
self.log("Removing all osds in host %s" % (host,))

for role in osds.remotes[host]:
if not role.startswith("osd."):
continue
osdid = int(role.split('.')[1])
if self.in_osds.count(osdid) == 0:
continue
self.out_osd(osdid)


def out_osd(self, osd=None):
"""
Expand Down Expand Up @@ -1227,13 +1246,19 @@ def choose_action(self):
minout = int(self.config.get("min_out", 0))
minlive = int(self.config.get("min_live", 2))
mindead = int(self.config.get("min_dead", 0))
thrash_hosts = self.config.get("thrash_hosts", False)

self.log('choose_action: min_in %d min_out '
'%d min_live %d min_dead %d '
'chance_down %.2f' %
(minin, minout, minlive, mindead, chance_down))
actions = []
if len(self.in_osds) > minin:
if thrash_hosts:
self.log("check thrash_hosts")
if len(self.in_osds) > minin:
self.log("check thrash_hosts: in_osds > minin")
actions.append((self.out_host, 1.0,))
elif len(self.in_osds) > minin:
actions.append((self.out_osd, 1.0,))
if len(self.live_osds) > minlive and chance_down > 0:
actions.append((self.kill_osd, chance_down,))
Expand Down

0 comments on commit 190a761

Please sign in to comment.