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)
mon: Paxos: finish_proposal() when we're finished recovering

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: Paxos: finish queued proposals instead of clearing the list

By finishing these Contexts, we make sure the Contexts they enclose (to be
called once the proposal goes through) will behave as their were initially
planned:  for instance, a C_Command() may retry the command if a -EAGAIN
is passed to 'finish_contexts', while a C_Trimmed() will simply set
'going_to_trim' to false.

This aims at fixing at least a bug in which Paxos will stop trimming if an
election is triggered while a trim is queued but not yet finished.  Such
happens because it is the C_Trimmed() context that is responsible for
resetting 'going_to_trim' back to false.  By clearing all the contexts on
the proposal list instead of finishing them, we stay forever unable to
trim Paxos again as 'going_to_trim' will stay True till the end of time as
we know it.

Fixes: #4895

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: Paxos: get rid of the 'prepare_bootstrap()' mechanism

We don't need it after all.  If we are in the middle of some proposal,
then we guarantee that said proposal is likely to be retried.  If we
haven't yet proposed, then it's forever more likely that a client will
eventually retry the message that triggered this proposal.

Basically, this mechanism attempted at fixing a non-problem, and was in
fact triggering some unforeseen issues that would have required increasing
the code complexity for no good reason.

Fixes: #5102

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
common: add mask argument to pick_addresses() to specify what we need

Fixes: #4228

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
ceph-mon: only care about public addr during pick_addresses()

Fixes: #4228

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
ceph-osd: specify which types of addresses to pick

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: PaxosService: drop atomic_t on 'proposing'

We don't need this to be atomic -- a simple boolean is enough.

Fixes: #4507

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Merge pull request #315 from ceph/wip-4507

Reviewed-by: Sage Weil <sage@inktank.com>
ceph-mds: specify which types of addresses to pick

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
ceph-syn: specify which types of addresses to pick

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
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>
Merge pull request #314 from ceph/wip-4228

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>