rgw: introduce decode_json to easily decode json structures

Introducing a new way to define the json structure of an
object, similar to what we do with bufferlist encode/decode.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: decode RGWUserInfo using decode_json

RGWUserInfo can be decoded using json_decode, and fix
the ->dump() method to match that decoding.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: rgw_jsonparser changes

Now testing json_decode functionality.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
moved rgw/rgw_json.* common/ceph_json.*

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: add encode_json

dump() just dumps the internal content of an object, encode_json()
create the object inside its own section. Note that there are cases
where we don't want an object to be surrounded by a section, e.g.,
when an object represents an array. In such a case we'd need to
override the encode_json() for this object type.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: generic decode_json for containers

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: s/cluster/zone

Old cluster definition is what we'd call zone from now on.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: zone info is configurable

Also rename RadosParams to ZoneParams

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
PendingReleaseNotes: mention renamin of cluster to zone

radosgw-admin now uses the term 'zone'

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
fix append to uninitialized buffer in FlatIndex::created

The long_name variable is not initialized. When the append_oname
function is called, it will strlen(long_name) and get a result
that depends on the stack content. The long_name is truncated to a
zero length string to prevent this unexpected behavior.

There is no sure way to trigger the problem by writing a unit
test. Unit tests are added for all public methods of the FlatIndex
class. Most of the time the tests fail if the long_name variable is
not properly initialized.

 * uint32_t collection_version()
 * coll_t coll() const
 * void set_ref(std::tr1::shared_ptr<CollectionIndex> ref)
 * int cleanup()
 * int init()
 * int created(const hobject_t &hoid, const char *path)
 * int unlink(const hobject_t &hoid)
 * int lookup(const hobject_t &hoid, IndexedPath *path, int *exist)
 * int collection_list(vector<hobject_t> *ls)
 * int collection_list_partial(const hobject_t &start, int min_count, int max_count, snapid_t seq, vector<hobject_t> *ls, hobject_t *next)

There are a number of border cases that cannot be tested, such as the
logic of the lfn_get static function. Since FlatIndex code is designed
to transition from older namespace conventions, it is difficult to
figure out.

The tests rely on xattr(2) and their availability is checked before
running them.

http://tracker.ceph.com/issues/4542 refs #4542

Signed-off-by: Loic Dachary <loic@dachary.org>
MDS.cc: remove double is_clientreplay() check in active_start()

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
CephMount.java: remove unused import

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
java libcephfs: add serialVersionUID to some Exception classes

Fix for: "The serializable class does not declare a static final
serialVersionUID field" warning.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
ceph_common.sh: fix typo in comment

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
mds: Clear backtrace updates on standby_trim_seg

If the mds is standby, when a segment is trimmed, we need
to clear the backtrace updates list to avoid the following
assertion when the segment is deleted.

./include/elist.h: 92: FAILED assert(_head.empty())
ceph version 0.59-478-g8befbca (8befbca77aa50a1188969892aabedaf11d8f8ce7)
(MDLog::standby_trim_segments()+0xce5) [0x6ccec5]
(MDS::C_MDS_StandbyReplayRestartFinish::finish(int)+0x39) [0x4e86b9]
(Journaler::_finish_reprobe(int, unsigned long, Context*)+0x190)
[0x6d3210]
(Filer::_probed(Filer::Probe*, object_t const&, unsigned long,
utime_t)+0x558) [0x704a88]
(Objecter::C_Stat::finish(int)+0xc0) [0x705900]
(Objecter::handle_osd_op_reply(MOSDOpReply*)+0xe38) [0x6f1df8]
(MDS::handle_core_message(Message*)+0xae8) [0x4dc318]
(MDS::_dispatch(Message*)+0x2f) [0x4dc4df]
(MDS::ms_dispatch(Message*)+0x1db) [0x4ddf7b]
(DispatchQueue::entry()+0x341) [0x81f561]
(DispatchQueue::DispatchThread::entry()+0xd) [0x79c6ad]
(()+0x7e9a) [0x7f346bb9ee9a]
(clone()+0x6d) [0x7f346a3574bd]

Fixes #4539.
Signed-off-by: Sam Lang <sam.lang@inktank.com>
mkcephfs.in: use mktemp instead of dd+md5sum+awk

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
mkcephfs.in: provide a valid rdir for MONs on -a

Provide also a valid rdir for ssh as in case of OSD/MDS hosts if
mkcephfs -a is called.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
mkcephfs.in: cleanup rdir in MON case

Remove $rdir in MON case of 'mkcephfs -a' as soon as it's no
longer needed.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Merge pull request #157 from ceph/wip-4539

mds: Clear backtrace updates on standby_trim_seg

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #152 from dalgaaf/wip-da-fix-misc

MDS.cc: remove double is_clientreplay() check in active_start()

Reviewed-by: Sage Weil <sage@inktank.com>