AsyncMessenger: Async event threads shared by all AsyncMessenger

WorkerPool is a singleton class which is served to AsyncMessenger. All
AsyncMessenger used the same worker pool.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncConnection: Ensure "mark_down" complete when returned

Now AsyncConnection try to process or modify any own variables within self
thread. It means actual function will be called by event loop not external.
So we can avoid lockdep or unnecessary lock for AsyncConnection.

So "mark_down" should be returned after _stop completed and all events has
be processed.

"external" for unregister_conn is unnecessary, because the caller won't
own AsyncMessenger::Lock again.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncConnection: Introduce "signal" event

Ensure signal cond after all previous events has be done

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Event: Fix Coverity error

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncConnection: Avoid deadlock for AsyncConnection::lock

accept and connection will be send to queue and deliver to dispatcher. So
it can avoid caller stuck into AsyncConnection::lock deadlock

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncConnection: Skip delete_file_event if sd < 0

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncMessenger: Fix thread destroy when no active Messenger

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Cycles: A precious performance profile tool using rdstc

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
ObjectStoreBenchmark: Used to perf ObjectStore::Transaction

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
CephContext: Add AssociatedSingletonObject to allow CephContext's singleton

If some objects associated to CephContext want to create a singleton object,
it can inherit AssociatedSingletonObject and implement destruction to get notified.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncMessenger: Make WorkerPool use CephContext's singleton

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
documentation: add centos 7 to ceph-deploy installation

http://tracker.ceph.com/issues/10246 Fixes: #10246

Signed-off-by: Loic Dachary <ldachary@redhat.com>
Merge pull request #3081 from dachary/wip-10246-centos7

doc: add centos 7 to ceph-deploy installation

Reviewed by: John Wilkins <jowilkin@redhat.com>
common/Initialize.h: add header file to Makefile.am

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
objectstore_tool: update usage strings

Signed-off-by: Loic Dachary <ldachary@redhat.com>
objectstore_tool: refactor list-lost and fix-lost

Abstract out the PG exploration loops and encapsulate the list-lost and
fix-lost semantic in a callable object.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
objectstore_tool: lookup objects by name

If the object is not a parsable JSON string, assume an object name and
look it up in all the PGs. If multiple objects have the same name, only
apply the command to one of them. It is primarily useful in a test
environment where the names of the tests objects are known and only a
small number of objects exists. It replaces the following:

    path='--data-path dev/osd0 --journal-path dev/osd0.journal'
    for pgid in $(./ceph_objectstore_tool $path --op list-pgs) ; do
      object=$(./ceph_objectstore_tool $path --pgid $pgid --op list |
               grep '"oid":"NAME"')
      test -n "$object" && break
    done
    ./ceph_objectstore_tool $path --pgid $pgid "$object" remove

with:

    ./ceph_objectstore_tool $path NAME remove

http://tracker.ceph.com/issues/10192 Fixes: #10192

Signed-off-by: Loic Dachary <ldachary@redhat.com>
objectstore_tool: filter --op list and explore all PGs

The positional object name is used to filter the output of --op list and
only show the objects with a matching name. If both the object name and
the pgid are omitted, all objects from all PGs are displayed.

The output format is changed from

    {"oid":"GROUP","key":"","snapid":-2,
     "hash":2659194943,"max":0,"pool":0,"namespace":""}

to

    [["0.7_head",{"oid":"GROUP","key":"","snapid":-2,
                  "hash":2659194943,"max":0,"pool":0,
                  "namespace":""}]]

where the first member is the pgid where the object is found.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
objectstore_tool: parse new object description format

The object format changed from

    {json object}

to

    [pgid,{json object}]

The parser is updated accordingly. If the --pgid is present, check that
it equals the pgid from the object description.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
objectstore_tool: test --op list variants

Signed-off-by: Loic Dachary <ldachary@redhat.com>