Commit Graph

26205 Commits

Author SHA1 Message Date
Dan Mick
3ff7c364d7 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>
2013-05-21 16:37:59 -07:00
Dan Mick
5f211ef221 ceph: clean up line wraps, comments, add verbose command output
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:37:59 -07:00
Dan Mick
95e411dcad ceph: implement -w/--watch.
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:37:59 -07:00
Dan Mick
2ce5cb7d06 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>
2013-05-21 16:37:59 -07:00
Dan Mick
48490841ed rados.py: implement rados_monitor_log
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:37:59 -07:00
Dan Mick
bcf064f82c 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>
2013-05-21 16:37:59 -07:00
Sage Weil
4dc6a166aa mon/PGMonitor: reflow command methods
- simplify dump_stuck_pg_stats() method
- default r = 0
- explicit update, reply labels
- avoid deep nesting when many error checks
- clean up return codes

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:37:59 -07:00
Sage Weil
590cffe201 mon/OSDMonitor: restructure command flow
- boilerplate at the top
- reply and update labels
- default r == 0
- explicitly fall out invalid or unrecognized commands in final else block

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:37:59 -07:00
Sage Weil
d87e3712d8 mon: fix 'osd dump'
Need to set r == 0.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:37:58 -07:00
Sage Weil
db589d1f52 vstart.sh: use new mon cap profiles
Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:37:58 -07:00
Sage Weil
05dda0f23e mon: weaken security check on 'log' command
The exec bit doesn't mean anything for the log; make it W.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:37:58 -07:00
Sage Weil
73d08b933f mon: wire new command map to new caps
We can drop the fullcmd nonsense entirely, yay!

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:37:58 -07:00
Dan Mick
839d5b3652 mon: transition from MonCaps -> MonCap
Convert all monitor users to use the new MonCap class.

Simplify the semantics around auids by essentially dropping any meaningful
permissions enforcement around them.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:37:55 -07:00
Sage Weil
917341ea62 ceph-object-corpus: note MForward encoding change
Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:23:43 -07:00
Sage Weil
5d7dd5ab67 mon: bump wire protocol version
We have changed MonCap encoding and command semantics (which affects
forwarding).  Bump the wire protocol version.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:23:43 -07:00
Sage Weil
1123fc293f mon/MonCap: add new MonCap implementation
This is a new class with a new grammer.  Implementation is modeled after
OSDCap, and the semantics are based on the old MonCaps, although somewhat
different (though not in too many important ways, I think).

Note that we complete drop auid support; the semantics for that were a
complete mess.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:23:43 -07:00
Sage Weil
27dc4fef03 osd/OSDCap: avoid typedef for rwxa_t; rename to osd_rwxa_t
Avoid implementing an operator<< on __u8, and make the naming less likely
to conflict with others.

We did a similar thing with MonCap.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:23:43 -07:00
Sage Weil
2aefee2107 osd/OSDCap: fix allow_all() check
Only return true for the global "allow all" if the match does not constrain
us at all.  This matches the set_allow_all() method.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:23:43 -07:00
Sage Weil
dc4a508411 ceph: remove ceph tool cli tests
This is dynamic and based on a running cluster's command set.  Drop it.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:23:43 -07:00
Sage Weil
039b757dd6 librados: add rados_monitor_log()
Add method to trail the cluster/monitor log for use by ceph -w.  Add a
simple functional test.

Note that changing the subscription level does not currently work
due to the protocol; you can't cancel a subscriptions.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:23:43 -07:00
Sage Weil
e830de58c1 librados: unit tests for mon_command
Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:23:43 -07:00
Dan Mick
63017ba38d rados.py: use librados-allocating versions of *_command
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:23:43 -07:00
Dan Mick
a090abfcd7 librados: use memcpy rather than strncpy for possibly-NUL data
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:23:43 -07:00
Dan Mick
d490041968 ceph: restructure so old-style commands and new-style can share code
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:23:43 -07:00
Dan Mick
93d8125d30 rados.py: remove debug prints from *_command
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:23:43 -07:00
Dan Mick
9e8397a216 Check for and handle old-monitor
If it doesn't support get_command_descriptions, just send the
entire command.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:23:42 -07:00
Dan Mick
d5075cab33 Return correct error to main; always write outs to stderr
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:23:42 -07:00
Dan Mick
2919bdec93 Set conffile to passed -c, not conf
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:23:42 -07:00
Dan Mick
d5497fa365 rados.py: errnos must have errno. qualifier 2013-05-21 16:23:42 -07:00
Dan Mick
7dbe4ef15c ceph: pop off 'target' before sending command 2013-05-21 16:23:42 -07:00
Dan Mick
808f518e0b ceph: fix exception msg 2013-05-21 16:23:42 -07:00
Dan Mick
3b7062b765 RadosClient: handle command replies 2013-05-21 16:23:42 -07:00
Sage Weil
2e52649268 ceph: 'ceph daemon <name|path> <command ...>'
This is *much* easier than 'ceph --admin-daemon <path> <command ...>'.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:23:42 -07:00
Sage Weil
e748d9bbee ceph: add support for --admin-socket <path>
Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:23:42 -07:00
Sage Weil
e3f13e8363 vstart.sh: set python path(s); echo something for user to paste
Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:23:42 -07:00
Sage Weil
aeeabcd662 librados: add *_command() variants that allocate the result w/ malloc
These are helpful for commands that may have large results and are
expensive to process and/or transfer because retrying very inefficient.
The caller is expected to free(3) the result.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 16:23:41 -07:00
Dan Mick
1af5f74a02 wip: osd tell commands, CephFileparse, etc. 2013-05-21 16:23:41 -07:00
Dan Mick
4698d99c38 Enhance cephtool tests for coverage of CLI rewrite
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 16:23:41 -07:00
Dan Mick
f26bd55e57 mon, ceph: transition to separate CLI parsing
ceph is a new Python CLI that:
1) queries the underlying cephbin to get command descriptors,
2) parses user input and validates everything possible,
3) passes validated JSON command to cephbin for handling

The frontend also presents help, and takes over the CLI command
looping mode.

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

Conflicts:

	src/mon/Monitor.cc
	src/mon/OSDMonitor.cc
2013-05-21 16:23:04 -07:00
Dan Mick
d9ff7d4a65 mon: add JSON command parsing framework
Use json_spirit to read/parse JSON command input into a "cmdmap",
which is a boost::variant typechecked discriminant union.
This means that requests to read from the map must match the type
given.  Types are string, bool, int64_t, double, and vector<string>,
and that type is a "cmd_vartype"; a cmdmap is a map of name (string) to
cmd_vartype.

Also, an evolutionary deadend hack "build_fullcmd()", which reassembles
certain commands from the cmdmap back into a string for the sole reason
of running them through _allowed_command.  This is due to be replaced by
a better allow mechanism very shortly.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 15:54:13 -07:00
Dan Mick
ed2266a02a Formatter: fix XML parsing assert
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 15:54:12 -07:00
Dan Mick
3148482614 Formatter: add new_formatter(type)
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 15:54:12 -07:00
Dan Mick
850a4cc4f1 Rename "ceph" tool to "ceph-legacy-cli"
Conflicts:
	src/Makefile.am

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 15:54:12 -07:00
Dan Mick
4227490f31 rados.py: functions for new librados functions {mon,osd,pg}_command
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 15:54:12 -07:00
Dan Mick
3bc0d3ffba Add C and C++ interfaces to mon_command, osd_command, pg_command
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 15:54:12 -07:00
Dan Mick
a9ce311717 str_list: cleanup/enhancement
- move #includes to str_list.h
- remove redundant std::, add using for vector, set, list
- add get_str_vec and get_str_set-no-delims

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2013-05-21 15:54:12 -07:00
Sage Weil
2e172225b0 osdc/Objecter: implement osd and pg commands
This is reimplementing the 'tell osd' and 'pg ...' commands in the ceph
tool in the Objecter infrastruture.  As a result we are forced to consider
all of the corner cases we have already handled for regular ops and
linger ops, so the result should be significantly more robust.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 15:54:12 -07:00
Sage Weil
9f55333cfa mon/MonClient: assume tid 0 is the first command
If we get an ack with no tid, we have to assume it is the first (hopefully
only) command we have in flight.  Old code doesn't properly set the tid.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 15:54:11 -07:00
Sage Weil
0c6a31c842 mon/MonClient: add mon command handling
Reimplement the ceph tool functionality to set a command to the monitor
and collect a response.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 15:54:11 -07:00
Sage Weil
5e21b3016a mon: set tid on MMonCommandAck
Set the tid on the reply to match the request.  This will allow a client
to have multiple commands in flight.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-05-21 15:54:11 -07:00