librados: rados_monitor_log's cb takes two ints rather than timespec

Handling struct timespec as a callback arg in Python was just too
weird to little benefit.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
rados.py: implement rados_monitor_log

Signed-off-by: Dan Mick <dan.mick@inktank.com>
rados.py: change all calls to librados to be on a child thread

Handling SIGINT while blocked in librados() requires said blocking
to not block the main Python thread, so arrange for all entries
into librados to be done on a child thread.  Loop polling join()
on that thread so that the main thread can see SIGINT.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph: implement -w/--watch.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph: clean up line wraps, comments, add verbose command output

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph: return error from json_command rather than raising exception

Print outs along with error, and return errno to caller if it happens

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph: send pgid in command strings of pg tell

It's also passed as part of the message, but to avoid having to
rev MCommand, just pass it in cmd there as well

Signed-off-by: Dan Mick <dan.mick@inktank.com>
MonmapMonitor: mon tell: allow 'type.id' or 'id' as well as 'n'

Signed-off-by: Dan Mick <dan.mick@inktank.com>
MonmapMonitor: use parsed destination for mon tell

Signed-off-by: Dan Mick <dan.mick@inktank.com>
rados.py: no exception on error, just return errno to caller

also fix up a comment

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph: allow CephName to validate when given only an 'id'

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph: move parsing of a json funcsig into function for reusability

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph: add partial to validate()

Allow validation of the front of a command, to precalculate the
target for a command (basically, whether it's a 'normal' monitor
command, a "tell <osd>" command, or a "pg <pgid>" command; the latter
two go to the OSD, and so the OSD needs to be consulted for valid
command lists *and* receive the command directly.  This means we
have to have some fixed preclassification of the command, which
is done with validate(partial=True).

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph: figure out which daemon should get a command early

Before even asking for a list of valid command signatures, do some fixed
parsing to figure out which daemon we should ask (and eventually send
the command to).  For pg commands, just let the objecter's pg_command
figure out where they should go.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph: hack for tell so that we don't have to duplicate "tell <target>"
in each command description

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph: cleanup: remove dead code/imports, note apparently-unused objects

Signed-off-by: Dan Mick <dan.mick@inktank.com>
mon, cmdparse: move dump_cmds_to_json to common/cmdparse

Also include ARRAY_SIZE macro

Signed-off-by: Dan Mick <dan.mick@inktank.com>
osd: handle new-style JSON commands directly (like mon)

'tell osd.n' and 'pg <pgid>' commands go directly to the OSD.
Both are enumerated in osd_commands[]; that could be cleaner but
it doesn't seem worth the effort.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
librados, rados.py: rados_*_command: pass inbuflen to handle zeroes

Signed-off-by: Dan Mick <dan.mick@inktank.com>
mon: fix stdout vs. stderr throughout monitor

Signed-off-by: Dan Mick <dan.mick@inktank.com>