Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / doc / man / 8 / ceph-dencoder.rst
1 :orphan:
2
3 ==============================================
4  ceph-dencoder -- ceph encoder/decoder utility
5 ==============================================
6
7 .. program:: ceph-dencoder
8
9 Synopsis
10 ========
11
12 | **ceph-dencoder** [commands...]
13
14
15 Description
16 ===========
17
18 **ceph-dencoder** is a utility to encode, decode, and dump ceph data
19 structures.  It is used for debugging and for testing inter-version
20 compatibility.
21
22 **ceph-dencoder** takes a simple list of commands and performs them
23 in order.
24
25 Commands
26 ========
27
28 .. option:: version
29
30    Print the version string for the **ceph-dencoder** binary.
31
32 .. option:: import <file>
33
34    Read a binary blob of encoded data from the given file.  It will be
35    placed in an in-memory buffer.
36
37 .. option:: export <file>
38
39    Write the contents of the current in-memory buffer to the given
40    file.
41
42 .. option:: list_types
43
44    List the data types known to this build of **ceph-dencoder**.
45
46 .. option:: type <name>
47
48    Select the given type for future ``encode`` or ``decode`` operations.
49
50 .. option:: skip <bytes>
51
52    Seek <bytes> into the imported file before reading data structure, use
53    this with objects that have a preamble/header before the object of interest.
54
55 .. option:: decode
56
57    Decode the contents of the in-memory buffer into an instance of the
58    previously selected type.  If there is an error, report it.
59
60 .. option:: encode
61
62    Encode the contents of the in-memory instance of the previously
63    selected type to the in-memory buffer.
64
65 .. option:: dump_json
66
67    Print a JSON-formatted description of the in-memory object.
68
69 .. option:: count_tests
70
71    Print the number of built-in test instances of the previosly
72    selected type that **ceph-dencoder** is able to generate.
73
74 .. option:: select_test <n>
75
76    Select the given build-in test instance as a the in-memory instance
77    of the type.
78
79 .. option:: get_features
80
81    Print the decimal value of the feature set supported by this version
82    of **ceph-dencoder**.  Each bit represents a feature.  These correspond to
83    CEPH_FEATURE_* defines in src/include/ceph_features.h.
84
85 .. option:: set_features <f>
86
87    Set the feature bits provided to ``encode`` to *f*.  This allows
88    you to encode objects such that they can be understood by old
89    versions of the software (for those types that support it).
90
91 Example
92 =======
93
94 Say you want to examine an attribute on an object stored by ``ceph-osd``.  You can do this:
95
96 ::
97
98     $ cd /mnt/osd.12/current/2.b_head
99     $ attr -l foo_bar_head_EFE6384B
100     Attribute "ceph.snapset" has a 31 byte value for foo_bar_head_EFE6384B
101     Attribute "ceph._" has a 195 byte value for foo_bar_head_EFE6384B
102     $ attr foo_bar_head_EFE6384B -g ceph._ -q > /tmp/a
103     $ ceph-dencoder type object_info_t import /tmp/a decode dump_json
104     { "oid": { "oid": "foo",
105           "key": "bar",
106           "snapid": -2,
107           "hash": 4024842315,
108           "max": 0},
109       "locator": { "pool": 2,
110           "preferred": -1,
111           "key": "bar"},
112       "category": "",
113       "version": "9'1",
114       "prior_version": "0'0",
115       "last_reqid": "client.4116.0:1",
116       "size": 1681,
117       "mtime": "2012-02-21 08:58:23.666639",
118       "lost": 0,
119       "wrlock_by": "unknown.0.0:0",
120       "snaps": [],
121       "truncate_seq": 0,
122       "truncate_size": 0,
123       "watchers": {}}
124
125 Alternatively, perhaps you wish to dump an internal CephFS metadata object, you might
126 do that like this:
127
128 ::
129
130    $ rados -p metadata get mds_snaptable mds_snaptable.bin
131    $ ceph-dencoder type SnapServer skip 8 import mds_snaptable.bin decode dump_json
132    { "snapserver": { "last_snap": 1,
133       "pending_noop": [],
134       "snaps": [],
135       "need_to_purge": {},
136       "pending_create": [],
137       "pending_destroy": []}} 
138
139
140 Availability
141 ============
142
143 **ceph-dencoder** is part of Ceph, a massively scalable, open-source, distributed storage system. Please
144 refer to the Ceph documentation at http://ceph.com/docs for more
145 information.
146
147
148 See also
149 ========
150
151 :doc:`ceph <ceph>`\(8)