Skip to content

Commit

Permalink
Merge pull request cernceph#38 from aphran/aphran-reweight-pool-check
Browse files Browse the repository at this point in the history
ceph-gentle-reweight: add check for test pool
  • Loading branch information
dvanders authored Sep 1, 2022
2 parents 47547a2 + 4c4e21d commit e4726bf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/ceph-gentle-reweight
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ def usage(code=0):
print 'ceph-gentle-reweight -o <osd>[,<osd>,...] [-l <max_latency (default=20)>] [-b <max pgs backfilling (default=50)>] [-d <delta weight (default=0.01)>] [-t <target weight (default=2)>] [-p <latency test pool (default=test)>] [-i <interval (default=60)>] [-s <start time (default=02:00)>] [-e <end time (default=09:00)>] [-a <day of week,[day of week,...]>]'
sys.exit(code)

def check_for_pool(pool):
pools_json = commands.getoutput('ceph osd pool ls --format=json 2>/dev/null')
pools = json.loads(pools_json)
if pool not in pools:
raise ValueError("Pool '%s' does not exist!" % pool)

def main(argv):
drain_osds = []
max_latency = 20
Expand Down Expand Up @@ -182,6 +188,8 @@ def main(argv):
print 'End time:', end_time
print 'Allowed days:', allowed_days

check_for_pool(test_pool)

while(True):
reweight_osds(drain_osds, max_pgs_backfilling, max_latency, delta_weight, target_weight, test_pool, start_time, end_time, allowed_days, interval, really)
print "main: sleeping %ss" % interval
Expand Down

0 comments on commit e4726bf

Please sign in to comment.