]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: ceph_objectstore_tool.py fix list-attr for erasure code 2915/head
authorDavid Zafman <dzafman@redhat.com>
Sat, 15 Nov 2014 19:43:10 +0000 (11:43 -0800)
committerLoic Dachary <ldachary@redhat.com>
Sat, 15 Nov 2014 22:31:34 +0000 (23:31 +0100)
Adding testing of xattr for erasure coded shards
Fix error message when finding an unexpected xattr key

Signed-off-by: David Zafman <dzafman@redhat.com>
src/test/ceph_objectstore_tool.py

index 62caee4db5a4be1d308baf88dafa3b33a17bfbb1..8a0e6de5f965f9daf9653c1ad0b214eed8e61c9d 100755 (executable)
@@ -591,7 +591,14 @@ def main(argv):
                     logging.error("{json} hinfo_key found {found} times instead of 3".format(json=JSON, found=found))
                     ERRORS += 1
 
-            for pg in OBJREPPGS:
+            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):
+                    continue
+                if 'shard_id' in jsondict:
+                    # Fix shard_id since we only have one json instance for each object
+                    jsondict['shard_id'] = int(string.split(pg, 's')[1])
+                    JSON = json.dumps(jsondict)
                 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))))
@@ -611,11 +618,11 @@ def main(argv):
                     keys = get_lines(ATTRFILE)
                     values = dict(db[nspace][basename]["xattr"])
                     for key in keys:
-                        if key == "_" or key == "snapset":
+                        if key == "_" or key == "snapset" or key == "hinfo_key":
                             continue
                         key = key.strip("_")
                         if key not in values:
-                            logging.error("The key {key} should be present".format(key=key))
+                            logging.error("Unexpected key {key} present".format(key=key))
                             ERRORS += 1
                             continue
                         exp = values.pop(key)