rgw: protect ops log socket formatter

Fixes: #4905
Ops log (through the unix domain socket) uses a formatter, which wasn't
protected.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
mon: implement --extract-monmap <filename>

This will make for a simpler process for
  http://ceph.com/docs/master/rados/operations/add-or-rm-mons/#removing-monitors-from-an-unhealthy-cluster

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit c0268e27497a4d8228ef54da9d4ca12f3ac1f1bf)
OSDMonitor: skip new pools in update_pools_status() and get_pools_health()

New pools won't be full.  mon->pgmon()->pg_map.pg_pool_sum[poolid] will
implicitly create an entry for poolid causing register_new_pgs() to assume that
the newly created pgs in the new pool are in fact a result of a split
preventing MOSDPGCreate messages from being sent out.

Fixes: #4813
Backport: cuttlefish
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
sysvinit: use known hostname $host instead of (incorrectly) recalculating

We would need to do hostname -s on the remote node, not the local one.
But we already have $host; use it!

Reported-by: Xiaoxi Chen <xiaoxi.chen@intel.com>
Signed-off-by: Sage Weil <sage@inktank.com>
sysvinit: fix osd weight calculation on remote hosts

We need to do df on the remote host, not locally.

Simlarly, the ceph command uses the osd key, which exists remotely; run it there.

Signed-off-by: Sage Weil <sage@inktank.com>
Merge pull request #316 from ceph/wip-sysvinit

Reviewed-by: Dan Mick <dan.mick@inktank.com>
mds: weaken reconnect assertion

See #5031.  This appears to be populated with another mds's mdsdir; just
not asserting avoids the problem for the time being.

Signed-off-by: Sage Weil <sage@inktank.com>
messages/MOSDMarkMeDown: fix uninit field

Fixes valgrind warning:
==14803== Use of uninitialised value of size 8
==14803==    at 0x12E7614: sctp_crc32c_sb8_64_bit (sctp_crc32.c:567)
==14803==    by 0x12E76F8: update_crc32 (sctp_crc32.c:609)
==14803==    by 0x12E7720: ceph_crc32c_le (sctp_crc32.c:733)
==14803==    by 0x105085F: ceph::buffer::list::crc32c(unsigned int) (buffer.h:427)
==14803==    by 0x115D7B2: Message::calc_front_crc() (Message.h:441)
==14803==    by 0x1159BB0: Message::encode(unsigned long, bool) (Message.cc:170)
==14803==    by 0x1323934: Pipe::writer() (Pipe.cc:1524)
==14803==    by 0x13293D9: Pipe::Writer::entry() (Pipe.h:59)
==14803==    by 0x120A398: Thread::_entry_func(void*) (Thread.cc:41)
==14803==    by 0x503BE99: start_thread (pthread_create.c:308)
==14803==    by 0x6C6E4BC: clone (clone.S:112)

Backport: cuttlefish
Signed-off-by: Sage Weil <sage@inktank.com>
rbd image_read.sh: ensure rbd is loaded

Make sure rbd is loaded before proceeding with the script.

Signed-off-by: Alex Elder <elder@inktank.com>
osd, mds: shut down async signal handler on exit

Signed-off-by: Sage Weil <sage@inktank.com>
osd: skip mark-me-down message if osd is not up

Fixes crash when the OSD has not successfully booted and gets a
SIGINT or SIGTERM.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: Add asserts for seg faults caused by corrupt OSDs

fixes: #5139

Signed-off-by: David Zafman <david.zafman@inktank.com>
osd/OSDMap: new_up_internal -> new_up_cluster

Signed-off-by: Sage Weil <sage@inktank.com>
osd/OSDMap: new_hb_up -> new_hb_back_up

Signed-off-by: Sage Weil <sage@inktank.com>
osd/OSDMap: hb_addr -> hb_back_addr

Signed-off-by: Sage Weil <sage@inktank.com>
osd/OSDMap: encode front heartbeat addr

Signed-off-by: Sage Weil <sage@inktank.com>
osd: create front and back hb messenger instances

The hb_front messenger is not used yet.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: send hb front addr to monitor at boot

We still aren't binding it to anything yet, or putting it in the OSDMap.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: bind front heartbeat messenger to public_addr

Signed-off-by: Sage Weil <sage@inktank.com>
msgr: take an arbitrary set of ports to avoid binding to

We used to only need to avoid 2 ports; now we need 3.  Make it a set so we
don't have this problem later.

Signed-off-by: Sage Weil <sage@inktank.com>