ceph-dencoder – ceph encoder/decoder utility

    Description

    ceph-dencoder is a utility to encode, decode, and dump ceph datastructures. It is used for debugging and for testing inter-versioncompatibility.

    • Print the version string for the ceph-dencoder binary.
    • import <file>
    • Read a binary blob of encoded data from the given file. It will beplaced in an in-memory buffer.
    • export <file>
    • Write the contents of the current in-memory buffer to the givenfile.
    • List the data types known to this build of ceph-dencoder.
    • type <name>
    • Select the given type for future or decode operations.
    • skip <bytes>
    • Seek into the imported file before reading data structure, usethis with objects that have a preamble/header before the object of interest.

    • decode
    • Decode the contents of the in-memory buffer into an instance of thepreviously selected type. If there is an error, report it.
    • encode
    • Encode the contents of the in-memory instance of the previouslyselected type to the in-memory buffer.
    • dump_json
    • Print a JSON-formatted description of the in-memory object.
    • select_test <n>
    • Select the given build-in test instance as a the in-memory instanceof the type.
    • get_features
    • Print the decimal value of the feature set supported by this versionof ceph-dencoder. Each bit represents a feature. These correspond toCEPHFEATURE* defines in src/include/ceph_features.h.
    • set_features <f>
    • Set the feature bits provided to encode to f. This allowsyou to encode objects such that they can be understood by oldversions of the software (for those types that support it).

    Example

    Alternatively, perhaps you wish to dump an internal CephFS metadata object, you mightdo that like this:

    1. $ rados -p metadata get mds_snaptable mds_snaptable.bin
    2. $ ceph-dencoder type SnapServer skip 8 import mds_snaptable.bin decode dump_json
    3. { "snapserver": { "last_snap": 1,
    4. "pending_noop": [],
    5. "snaps": [],
    6. "need_to_purge": {},
    7. "pending_destroy": []}}

    See also

    (8)