]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_objectstore_tool: skip unused osds
authorLoic Dachary <ldachary@redhat.com>
Wed, 19 Nov 2014 18:03:57 +0000 (19:03 +0100)
committerDavid Zafman <dzafman@redhat.com>
Wed, 4 Mar 2015 00:03:59 +0000 (16:03 -0800)
When the number of objects is low, some OSDs may not be used at all.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
(cherry picked from commit 9a089ef369174a241098f2c5c28bcb29fe09eb58)

tasks/ceph_objectstore_tool.py

index a065787e79b42d9841499e6c0cb5dc095202d109..73f7aeb148c86fa9e3da2d99b8e8bea5413caf33 100644 (file)
@@ -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))