ceph-disk: use get_dev_name() helper throughout

This is more robust than the broken split trick.

Signed-off-by: Sage Weil <sage@inktank.com>
ceph-disk: reimplement is_partition() using /sys/block

Signed-off-by: Sage Weil <sage@inktank.com>
ceph-disk: use /sys/block to determine partition device names

Not all devices are basename + number; some have intervening character(s),
like /dev/cciss/c0d1p2.

Signed-off-by: Sage Weil <sage@inktank.com>
Merge branch 'wip-ceph-disk' into next

Reviewed-by: Gary Lowell <gary.lowell@inktank.com>
Tested-by: Jing Yuan Luke <jyluke@gmail.com>
osdmaptool: fix cli tests

From the HASHPSPOOL change in acbc2f0bc0b4266125403aebb28e6e3a2365394d.

Signed-off-by: Sage Weil <sage@inktank.com>
mon/MDSMonitor: make 'mds cluster_{up,down}' idempotent

Signed-off-by: Sage Weil <sage@inktank.com>
ceph: send successful commands twice with CEPH_CLI_TEST_DUP_COMMAND

Monitor commands need to be idempotent.  This helps us test this by
simply issuing any successful command a second time so that we notice
when a dup submission fails.

Signed-off-by: Sage Weil <sage@inktank.com>
qa/workunits/cephtool/test.sh: mds cluster_down/up are idempotent

As of d45429b81ab9817284d6dca98077cb77b5e8280f; fix the test.

Signed-off-by: Sage Weil <sage@inktank.com>
mon/AuthMonitor: make 'auth del ...' idempotent

Signed-off-by: Sage Weil <sage@inktank.com>
OSD::_try_resurrect_pg: fix cur/pgid confusion

This bug prevented resurrection of ancestor pgs where
necessary.

Fixes: #5269
This may result in pg A being created just before pg B
is resurrected and split into A and B resulting in one
or the other operations getting and EEXIST.

Backport: cuttlefish
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #423 from dalgaaf/wip-da-SCA-pylint

ceph.in, ceph_argparse.py: Fix some pylint issues

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
mon: MonCommands: remove obsolete 'sync status' command

Obsoleted by the sync refactor from
da0aff28ab478bcc3136715f92bc1af8d4b403c1

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
qa/workunits/cephtest/test.sh: put 'osd ls' before any 'osd create' tests

A monc/mon connection fault or the dup command test flag may mean an extra
osd id is created that we isn't actually up; reorder so that doesn't screw
up 'osd ls'.

Signed-off-by: Sage Weil <sage@inktank.com>
mon/OSDMonitor: make 'osd pool mksnap ...' not expose uncommitted state

We were returning success without waiting if the pending pool state had
the snap.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
ceph_mon: obtain backup monmap if store is marked with 'force_sync'

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
msg/Pipe: assert lock is held in various helpers

These all require that we hold pipe_lock.

Signed-off-by: Sage Weil <sage@inktank.com>
msg/Pipe: avoid creating empty out_q entry

We need to maintain the invariant that all sub queues in out_q are never
empty.  Fix discard_requeued_up_to() to avoid creating an entry unless we
know it is already present.

This bug leads to an incorrect reconnect attempt when

 - we accept a pipe (lossless peer)
 - they send some stuff, maybe
 - fault
 - we initiate reconnect, even tho we have nothing queued

In particular, we shouldn't reconnect because we aren't checking for
resets, and the fact that our out_seq is 0 while the peer's might be
something else entirely will trigger asserts later.

This fixes at least one source of #5626, and possibly #5517.

Backport: cuttlefish
Signed-off-by: Sage Weil <sage@inktank.com>
msg/Pipe: unlock msgr->lock earlier in accept()

Small cleanup.  Nothing needs msgr->lock for the previously larger
window.

Signed-off-by: Sage Weil <sage@inktank.com>
msgr: mark_down_all() after, not before, rebind

If we are shutting down all old connections and binding to new ports,
we want to avoid a sequence like:

 - close all prevoius connections
 - new connection comes in on old port
 - rebind to new ports
 -> connection from old port leaks through

As a first step, close all connections after we shut down the old
accepter and before we start the new one.

Signed-off-by: Sage Weil <sage@inktank.com>
msgr: adjust nonce on rebind()

We can have a situation where:

 - we have a pipe to a peer
 - pipe goes to standby (on peer)
 - we rebind to a new port
 - ....
 - we rebind again to the same old port
 - we connect to peer

and get reattached to the ancient pipe from two instances back.  Avoid that
by picking a new nonce each time we rebind.

Add 1,000,000 each time so that the port is still legible in the printed
output.

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