From 7293b1e343fbd3fc9f6d147b9c5a40664dfc4966 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Sat, 26 Jan 2019 11:24:38 -0800 Subject: [PATCH] test: ceph-objectstore-tool: Fix EC code handling so it doesn't skip EC objects Signed-off-by: David Zafman (cherry picked from commit 786b39f18f6df21991582c178595ce87d28633d1) --- .../special/ceph_objectstore_tool.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/qa/standalone/special/ceph_objectstore_tool.py b/qa/standalone/special/ceph_objectstore_tool.py index 0c6097c1f513b..e086bfc11e3e3 100755 --- a/qa/standalone/special/ceph_objectstore_tool.py +++ b/qa/standalone/special/ceph_objectstore_tool.py @@ -1497,16 +1497,16 @@ def main(argv): JSON = db[nspace][basename]['json'] jsondict = json.loads(JSON) - if 'shard_id' in jsondict: + if 'shard_id' in jsondict[1]: logging.debug("ECobject " + JSON) found = 0 for pg in OBJECPGS: OSDS = get_osds(pg, OSDDIR) # Fix shard_id since we only have one json instance for each object - jsondict['shard_id'] = int(pg.split('s')[1]) - JSON = json.dumps(jsondict) + jsondict[1]['shard_id'] = int(pg.split('s')[1]) + JSON = json.dumps((pg, jsondict[1])) for osd in OSDS: - cmd = (CFSD_PREFIX + "--pgid {pg} '{json}' get-attr hinfo_key").format(osd=osd, pg=pg, json=JSON) + cmd = (CFSD_PREFIX + " '{json}' get-attr hinfo_key").format(osd=osd, json=JSON) logging.debug("TRY: " + cmd) try: out = check_output(cmd, shell=True, stderr=subprocess.STDOUT) @@ -1522,12 +1522,12 @@ def main(argv): for pg in ALLPGS: # Make sure rep obj with rep pg or ec obj with ec pg - if ('shard_id' in jsondict) != (pg.find('s') > 0): + if ('shard_id' in jsondict[1]) != (pg.find('s') > 0): continue - if 'shard_id' in jsondict: + if 'shard_id' in jsondict[1]: # Fix shard_id since we only have one json instance for each object - jsondict['shard_id'] = int(pg.split('s')[1]) - JSON = json.dumps(jsondict) + jsondict[1]['shard_id'] = int(pg.split('s')[1]) + JSON = json.dumps((pg, jsondict[1])) OSDS = get_osds(pg, OSDDIR) for osd in OSDS: DIR = os.path.join(OSDDIR, os.path.join(osd, os.path.join("current", "{pg}_head".format(pg=pg)))) @@ -1536,7 +1536,7 @@ def main(argv): if not fnames: continue afd = open(ATTRFILE, "wb") - cmd = (CFSD_PREFIX + "--pgid {pg} '{json}' list-attrs").format(osd=osd, pg=pg, json=JSON) + cmd = (CFSD_PREFIX + " '{json}' list-attrs").format(osd=osd, json=JSON) logging.debug(cmd) ret = call(cmd, shell=True, stdout=afd) afd.close() @@ -1556,7 +1556,7 @@ def main(argv): continue exp = values.pop(key) vfd = open(VALFILE, "wb") - cmd = (CFSD_PREFIX + "--pgid {pg} '{json}' get-attr {key}").format(osd=osd, pg=pg, json=JSON, key="_" + key) + cmd = (CFSD_PREFIX + " '{json}' get-attr {key}").format(osd=osd, json=JSON, key="_" + key) logging.debug(cmd) ret = call(cmd, shell=True, stdout=vfd) vfd.close() -- 2.39.5