From e5bb475833459b9bbbf0dca1db5079dcd5a0ed9c Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Wed, 19 Nov 2014 19:03:57 +0100 Subject: [PATCH] ceph_objectstore_tool: skip unused osds When the number of objects is low, some OSDs may not be used at all. Signed-off-by: Loic Dachary (cherry picked from commit 9a089ef369174a241098f2c5c28bcb29fe09eb58) --- tasks/ceph_objectstore_tool.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tasks/ceph_objectstore_tool.py b/tasks/ceph_objectstore_tool.py index a065787e79b42..73f7aeb148c86 100644 --- a/tasks/ceph_objectstore_tool.py +++ b/tasks/ceph_objectstore_tool.py @@ -290,6 +290,8 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec = False): if string.find(role, "osd.") != 0: continue osdid = int(role.split('.')[1]) + if osdid not in pgs: + continue log.info("process osd.{id} on {remote}".format(id=osdid, remote=remote)) for pg in pgs[osdid]: cmd = (prefix + "--op list --pgid {pg}").format(id=osdid, pg=pg) @@ -333,7 +335,7 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec = False): if string.find(role, "osd.") != 0: continue osdid = int(role.split('.')[1]) - if not pgs.has_key(osdid): + if osdid not in pgs: continue for pg, JSON in db[basename]["pg2json"].iteritems(): @@ -403,6 +405,8 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec = False): if string.find(role, "osd.") != 0: continue osdid = int(role.split('.')[1]) + if osdid not in pgs: + continue for pg, JSON in db[basename]["pg2json"].iteritems(): if pg in pgs[osdid]: @@ -467,6 +471,8 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec = False): if string.find(role, "osd.") != 0: continue osdid = int(role.split('.')[1]) + if osdid not in pgs: + continue for pg in pgs[osdid]: cmd = (prefix + "--op info --pgid {pg}").format(id=osdid, pg=pg).split() @@ -487,6 +493,8 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec = False): if string.find(role, "osd.") != 0: continue osdid = int(role.split('.')[1]) + if osdid not in pgs: + continue for pg in pgs[osdid]: cmd = (prefix + "--op log --pgid {pg}").format(id=osdid, pg=pg).split() @@ -511,6 +519,8 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec = False): if string.find(role, "osd.") != 0: continue osdid = int(role.split('.')[1]) + if osdid not in pgs: + continue for pg in pgs[osdid]: fpath = os.path.join(DATADIR, "osd{id}.{pg}".format(id=osdid, pg=pg)) @@ -531,6 +541,8 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec = False): if string.find(role, "osd.") != 0: continue osdid = int(role.split('.')[1]) + if osdid not in pgs: + continue for pg in pgs[osdid]: cmd = (prefix + "--op remove --pgid {pg}").format(pg=pg, id=osdid) @@ -551,6 +563,8 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec = False): if string.find(role, "osd.") != 0: continue osdid = int(role.split('.')[1]) + if osdid not in pgs: + continue for pg in pgs[osdid]: fpath = os.path.join(DATADIR, "osd{id}.{pg}".format(id=osdid, pg=pg)) -- 2.39.5