]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_objectstore_tool: add hinfo_key tests for erasure coded objects
authorLoic Dachary <ldachary@redhat.com>
Mon, 17 Nov 2014 16:33:56 +0000 (17:33 +0100)
committerDavid Zafman <dzafman@redhat.com>
Wed, 4 Mar 2015 00:03:59 +0000 (16:03 -0800)
When an hinfo_key attribute is found, assume an erasure coded object and
verify set-attr/get-attr works as expected by removing its content and
restoring it.

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

tasks/ceph_objectstore_tool.py

index d21236d0b5f2ab36bc38755b28e2f6d2038143db..4e9c6dbf08b21b5f32a355b6c80a20d3b2ca6aaa 100644 (file)
@@ -403,6 +403,22 @@ def task(ctx, config):
                             if exp != val:
                                 log.error("For key {key} got value {got} instead of {expected}".format(key=key, got=val, expected=exp))
                                 ERRORS += 1
+                        if "hinfo_key" in keys:
+                            cmd_prefix = prefix.format(id=osdid)
+                            cmd = """
+                            expected=$({prefix} --pgid {pg} '{json}' get-attr {key} | base64)
+                            echo placeholder | {prefix} --pgid {pg} '{json}' set-attr {key} -
+                            test $({prefix} --pgid {pg} '{json}' get-attr {key}) = placeholder
+                            echo $expected | base64 --decode | {prefix} --pgid {pg} '{json}' set-attr {key} -
+                            test $({prefix} --pgid {pg} '{json}' get-attr {key} | base64) = $expected
+                            """.format(prefix=cmd_prefix, pg=pg, json=JSON, key="hinfo_key")
+                            log.debug(cmd)
+                            proc = remote.run(args=['bash', '-e', '-x', '-c', cmd], check_status=False, stdout=StringIO(), stderr=StringIO())
+                            proc.wait()
+                            if proc.exitstatus != 0:
+                                log.error("failed with " + str(proc.exitstatus))
+                                log.error(proc.stdout.getvalue() + " " + proc.stderr.getvalue())
+                                ERRORS += 1
 
                         if len(values) != 0:
                             log.error("Not all keys found, remaining keys:")