ceph-dencoder – ceph encoder/decoder utility

Synopsis

ceph-dencoder [commands…]

Description

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

ceph-dencoder takes a simple list of commands and performs themin order.

Commands

  • version
  • 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_types
  • List the data types known to this build of ceph-dencoder.
  • type <name>
  • Select the given type for future encode 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.
  • count_tests
  • Print the number of built-in test instances of the previouslyselected type that ceph-dencoder is able to generate.
  • 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

Say you want to examine an attribute on an object stored by ceph-osd. You can do this:

  1. $ cd /mnt/osd.12/current/2.b_head
  2. $ attr -l foo_bar_head_EFE6384B
  3. Attribute "ceph.snapset" has a 31 byte value for foo_bar_head_EFE6384B
  4. Attribute "ceph._" has a 195 byte value for foo_bar_head_EFE6384B
  5. $ attr foo_bar_head_EFE6384B -g ceph._ -q > /tmp/a
  6. $ ceph-dencoder type object_info_t import /tmp/a decode dump_json
  7. { "oid": { "oid": "foo",
  8. "key": "bar",
  9. "snapid": -2,
  10. "hash": 4024842315,
  11. "max": 0},
  12. "locator": { "pool": 2,
  13. "preferred": -1,
  14. "key": "bar"},
  15. "category": "",
  16. "version": "9'1",
  17. "prior_version": "0'0",
  18. "last_reqid": "client.4116.0:1",
  19. "size": 1681,
  20. "mtime": "2012-02-21 08:58:23.666639",
  21. "lost": 0,
  22. "wrlock_by": "unknown.0.0:0",
  23. "snaps": [],
  24. "truncate_seq": 0,
  25. "truncate_size": 0,
  26. "watchers": {}}

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_create": [],
  8. "pending_destroy": []}}

Availability

ceph-dencoder is part of Ceph, a massively scalable, open-source, distributed storage system. Pleaserefer to the Ceph documentation at http://ceph.com/docs for moreinformation.

See also

ceph(8)