Commit Graph

351 Commits

Author SHA1 Message Date
Kefu Chai
6f7bcfbfd7 mgr/PyState: fix leak if type is unknown
this silences a clang analyzer warning:

Potential leak of memory pointed to by 'c'

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-07-08 20:18:20 +08:00
Yuri Weinstein
795eccfe21 Merge pull request #16078 from xiexingguo/wip-misc
mon, osd: misc fixes

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-07-07 15:15:58 -07:00
xie xingguo
722b27cd12 mon/OSDMonitor: add more wildcards support for scrub and fix description
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
2017-07-06 10:18:32 +08:00
John Spray
e0e87da652 mgr: send beacon to mon as soon as done with Mgr::init
...instead of waiting for next periodic beacon.

Signed-off-by: John Spray <john.spray@redhat.com>
2017-07-04 19:07:58 -04:00
John Spray
f25763208f mgr: wait for mon digest on startup
This is to avoid starting the python modules
before the mon_status and health information
is available.

Fixes: http://tracker.ceph.com/issues/20383
Signed-off-by: John Spray <john.spray@redhat.com>
2017-07-04 19:07:04 -04:00
Sage Weil
d953198aff mon,mgr: track available modules in MgrMap too
Require --force to enable a module that isn't reported as available.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-29 23:10:51 -04:00
Sage Weil
16fcee1f71 mon,mgr: manage mgr module list in mgrmap
Kill old mgr_modules option.

Add new mgr_initial_modules option, on the mon, for the initial cluster
mgrmap.

Add ls, enable, disable commands.

Respawn mgr if the module list changes.  In the future we could enable
new modules without a full restart, but disabling probably requires (and
is best handled by) a respawn.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-29 23:10:51 -04:00
Sage Weil
6c10417f7e mgr: include MgrMap in ClusterState
Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-29 23:10:00 -04:00
Sage Weil
d6a13358b5 Merge pull request #15927 from jcsp/wip-mgr-log-on-load-failed
mgr: cluster log message on plugin load error

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-06-29 22:04:20 -05:00
Sage Weil
ba734f34e8 Merge pull request #15896 from Yan-waller/wip-waller-mgrcleanup0624
mgr: drop repeated log info. and unnecessary write permission

Reviewed-by: John Spray <john.spray@redhat.com>
Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-06-27 10:21:46 -05:00
John Spray
67bd8c40ed mgr: cluster log message on plugin load error
To make it a bit more obvious what's going on, otherwise
user's first sign is when they try and use a CLI bit
and get a command not found.

Signed-off-by: John Spray <john.spray@redhat.com>
2017-06-27 10:59:07 +01:00
Yan Jun
455589906c mgr: use readable errno strings
Signed-off-by: Yan Jun <yan.jun8@zte.com.cn>
2017-06-26 10:07:25 +08:00
Yan Jun
b0d75495db mgr: remove repeated function log
In the front of this file, '__func__' has been added to dout_prefix as below:

"  #define dout_prefix *_dout << "mgr.server " << __func__ << " "    "

Signed-off-by: Yan Jun <yan.jun8@zte.com.cn>
2017-06-24 14:54:04 +08:00
Kefu Chai
40b96745f0 mgr: enable ceph_send_command() to send pg command
Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-06-23 12:02:03 +08:00
Sage Weil
368ff5e4aa Merge pull request #15697 from gregsfortytwo/wip-mgr-eaccss-20296
mgr: print a more helpful error message for when users lack mgr ceph caps

Reviewed-by: Alfredo Deza <adeza@redhat.com>
Reviewed-by: xie xingguo <xie.xingguo@zte.com.cn>
2017-06-19 22:34:35 -05:00
Sage Weil
36cb4629dc Merge pull request #15533 from liewegas/wip-crush-version
mon,osd: add crush_version to OSDMap, and allow crush map updates to gate on crush_version

Reviewed-by: Loic Dachary <loic@dachary.org>
2017-06-19 18:06:07 -05:00
Sage Weil
6856fe7d6c Merge pull request #15716 from jcsp/wip-mgr-fsmap
mgr: fix MgrStandby eating messages

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-06-17 16:21:03 -05:00
Greg Farnum
6846f4830c mgr: print a more helpful error message for when users lack mgr cephx caps
Add some brief documentation on updating their caps and link to it.

Fixes: http://tracker.ceph.com/issues/20296

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
2017-06-16 18:41:10 -07:00
Sage Weil
1afcf4e942 mgr/DaemonServer: print PGMapDigest summary on send
Useful for debugging.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-16 17:15:37 -04:00
Kefu Chai
25576bb524 Merge pull request #15704 from tchaikov/wip-mgr-raise-in-send-command
mgr: raise python exception on failure in send_command()

Reviewed-by: Sage Weil <sage@redhat.com>
2017-06-16 09:57:51 +08:00
John Spray
f6ba8ab797 mgr: fix MgrStandby eating messages
It was failing to pass up the Mgr::ms_dispatch
return value, so messages were being consumed
even if Mgr was returning false.  Mgr returns
false to enable Client to see FSMap, so the
symptom was the Client not working.

While we're here, refactor switch into if, because
there were only two paths in the switch and we
don't expect to be adding more.

Signed-off-by: John Spray <john.spray@redhat.com>
2017-06-15 18:38:27 -04:00
Sage Weil
ebd4c4fa8a mgr/MgrClient: skip sending stats if no session
Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-15 13:41:30 -04:00
Kefu Chai
a1c9f69c64 mgr: raise python exception on failure in send_command()
Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-06-15 15:49:44 +08:00
Greg Farnum
19810df09e mon: mgr: enable "osd df" on the manager
Fixes: http://tracker.ceph.com/issues/20256

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
2017-06-14 17:02:49 -07:00
Greg Farnum
a9fbfc8763 mon: mgr: move 'osd df' handling to manager
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
2017-06-14 17:01:32 -07:00
Sage Weil
86c851e138 mgr/PyFormatter: implement dump_format_va
Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-12 09:57:00 -04:00
Yuri Weinstein
b38272a7d8 Merge pull request #15573 from liewegas/wip-20208
mon/PGMap: fix osd_epoch update when removing osd_stat

Reviewed-by: Kefu Chai <kchai@redhat.com>
Reviewed-by: Loic Dachary <loic@dachary.org>
2017-06-09 09:00:10 -07:00
Sage Weil
6c776f5d8a Merge pull request #15560 from dmick/master
mgr/DaemonServer.cc: log daemon type string as well as id

Reviewed-by: Kefu Chai <kchai@redhat.com>
Reviewed-by: John Spray <john.spray@redhat.com>
2017-06-08 20:38:58 -05:00
Sage Weil
c2e346cf12 Merge pull request #15562 from tchaikov/wip-no-assert.h
common,osdc: remove atomic_t completely

Reviewed-by: Sage Weil <sage@redhat.com>
2017-06-08 20:38:23 -05:00
Sage Weil
860d5cee28 Merge pull request #15578 from jcsp/wip-mgr-cleanup
mgr: cleanup, stop clients sending in perf counters

Reviewed-by: Sage Weil <sage@redhat.com>
2017-06-08 20:37:53 -05:00
Sage Weil
1101661a2b Merge pull request #15405 from liewegas/wip-rest-test
pybind/mgr/restful: improve cert handling; work with vstart

Reviewed-by: Boris Ranto <branto@redhat.com>
2017-06-08 17:07:22 -05:00
Sage Weil
f05a34aff2 Merge pull request #15557 from liewegas/wip-mgr-respawn
mgr/MgrStandby: respawn when deactivated

Reviewed-by: John Spray <john.spray@redhat.com>
2017-06-08 15:45:52 -05:00
Sage Weil
30ae537a55 mgr/Mgr: fix deadlock in load_config
Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-08 14:30:10 -04:00
Sage Weil
1ebc3f12aa mgr: add get_config_prefix
Fetch a dict of all config options with a given prefix.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-08 14:29:37 -04:00
Sage Weil
c7cfbc2bd5 mgr/PyState: add get_mgr_id() to module interface
Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-08 14:29:37 -04:00
Sage Weil
b5994f3ee0 mgr/PyModules: prefix by mgr/, not mgr/$id/
If modules want per-instance state, they can include
the mgr id in their portion of the key name.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-08 14:29:37 -04:00
John Spray
040e8cf306 mgr: drop PyModules::lock around module shutdown calls
This deadlocked if the module's shutdown call was trying
to take a pythonland lock that was held by a thread
that was in turn trying to call into C++ land and take
PyModules::lock.

Signed-off-by: John Spray <john.spray@redhat.com>
2017-06-08 10:03:55 -04:00
John Spray
8f1146aad2 mgr: don't let TYPE_CLIENT entities send stats
Anyone instantiating librados instances ended up
appearing as a weird entry in DaemonStateIndex.

Come back to this at the point we want e.g. stats
from RGWs or NFS gateways.

Signed-off-by: John Spray <john.spray@redhat.com>
2017-06-08 10:03:55 -04:00
John Spray
ec9801ec94 mgr: don't log successful ceph_config_get as err
Signed-off-by: John Spray <john.spray@redhat.com>
2017-06-08 09:57:20 -04:00
Sage Weil
c225899139 mgr/ClusterState: dump pgmap and inc at dout 30
Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-08 09:17:43 -04:00
Kefu Chai
28c8373734 msg,common: do not include assert.h everywhere to clobber <assert.h>
* reverts c93daaf92b
* add "#include "include/assert.h" to where <cassert> or <assert.h> are
  included, or avoid including them if possible.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-06-08 11:46:26 +08:00
Dan Mick
0384acea9d mgr/DaemonServer.cc: log daemon type string as well as id
Signed-off-by: Dan Mick <dan.mick@redhat.com>
2017-06-07 19:52:13 -07:00
Kefu Chai
c7034595b8 Merge pull request #14866 from chardan/jfw-wip-halflife_atomic_t-varan
common,test: migrate atomic_t to std::atomic

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-06-08 09:57:26 +08:00
Sage Weil
2fd49a1a61 mgr/MgrStandby: respawn when deactivated
- It is ugly to unwind all of the Mgr state so that we can reactivate
  later.
- It is perhaps impossible to do shut down the python state reliably.
- Respawning provides a clean state and is reliable.

This mostly just copies MDSServer::respawn().

Fixes: http://tracker.ceph.com/issues/19595
Fixes: http://tracker.ceph.com/issues/19549
Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-07 16:54:19 -04:00
Sage Weil
6a4f651140 mgr/DaemonServer: stop spamming log with pg stats
This clutters up the log.  We should instead log to health, or other
important events.

Note that we still have ceph health logged at regular intervals, so some
of this will surface there.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-05 12:11:27 -04:00
Jesse Williamson
c93daaf92b compile fixups for dout
Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
2017-06-02 12:02:04 -07:00
Greg Farnum
8b164903be mon: mgr: pgstats: do available-space calculations on mgr instead of mon
This means we don't need the osd_stat map on the monitor at all. We're
about to remove it entirely!

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
2017-06-02 13:06:49 -04:00
Kefu Chai
aad1afcb96 mgr: reset pending_inc after applying it
we cannot apply pending_inc twice and expect the result is the same. in
other words, pg_map.apply_incremental(pending_inc) is not an idempotent
operation.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-06-02 13:06:47 -04:00
Sage Weil
15f823b43e mgr/MgrStandby: reset subscriptions when we become non-active
This is a goofy workaround that we're also doing in Mgr::init().  Someday
we should come up with a more elegant solution.  In the meantime, this
works just fine!

Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-02 13:02:54 -04:00
Sage Weil
6afca3beb2 mgr/ClusterState: make pg stat filtering less fragile
We want to drop updates for pgs for pools that don't exist.  Keep an
updated set of those pools instead of relying on the previous PGMap
having them instantiated.  (The previous map may drift due to bugs.)

Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-02 13:02:54 -04:00
Sage Weil
dcc4c52ee8 mgr/DaemonServer: log pgmap usage to cluster log
Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-02 13:02:54 -04:00
Sage Weil
d6d1db62ed mgr: apply PGMap incremental at same interval as reports
We were doing an incremental per osd stat report; this screws up the
delta stats updates when there are more than a handful of OSDs.  Instead,
do it with the same period as the mgr->mon reports.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-02 13:02:53 -04:00
Sage Weil
578cd59dd8 mgr: drop useless __func__ prints
This is part of the default prefix.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-02 13:02:53 -04:00
Sage Weil
0612b71627 mgr: simplify handling of new pgs/pools
Instantiate barebones pg records (creating+stale) in our PGMap when pgs
are created.  These will switch to 'creating' when the pgs is in the
process of creating, and peering etc.  The 'stale' is an indicator that
the mon may not have even asked the pg to create them yet.

All of the old meticulous tracking in PGMap for mappings for creating
pgs is useless to us; OSDMonitor has new code to handle it.  This is
fast and simple.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-02 13:02:51 -04:00
Sage Weil
681d37c055 mgr/ClusterState: apply latest osdmap to pgmap
In particular, clear out deleted pools and clear osd stats for
deleted/down/out osds.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-02 13:02:50 -04:00
Sage Weil
acfebf27d1 mgr,mon: move 'osd {scrub,deep-scrub,repair}' handling to mgr
Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-02 13:02:48 -04:00
Sage Weil
b01c0d36b6 mgr/DaemonServer: use registered osd session to send scrub messages
Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-02 13:02:48 -04:00
Sage Weil
9fa1b382ef mgr/DaemonServer: keep registry of osd sessions
Occasionally we send them messages.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-02 13:02:48 -04:00
Kefu Chai
74752505bf mgr: add a command "mgr report"
* extract send_report() out of tick() so it can be reused.
* add a commmand "mgr report-mon" for mgr, so we are able to flush the
  the mgr stats to mon actively without waiting for the tick. this
  could help with the tests.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-06-02 13:02:46 -04:00
Sage Weil
27bd39cd05 mgr/ClusterState: report health about pgs
Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-02 13:02:10 -04:00
Kefu Chai
b306e9e0ac osd: stop sending pgstat if luminous
we don't send pgstat to mon from osd once we set
CEPH_OSDMAP_REQUIRE_LUMINOUS. and cleanup the pgstat queue when we
do the switch.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-06-02 13:02:09 -04:00
Sage Weil
b73e437414 mgr: send PGMapDigest instead of PGMap to mon
Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-02 13:02:08 -04:00
Sage Weil
8f2521617e mon/PGMap: move summary information into parent PGMapDigest object
Everything summary-ish that we need to send to the mon is moved into a
parent class.  The child PGMap retains the detail.

The parent gets its own encode(), and PGMap::encode_digest() will call it
to encode just the summary info.

Squashed in here is a new num_pg_by_osd that could have been done
in a preceding patch but I did things in the wrong order.  :(

Signed-off-by: Sage Weil <sage@redhat.com>
2017-06-02 13:02:05 -04:00
Greg Farnum
759c7d0aee mon: mgr: send a pgmap in reports
This definitely isn't appropriate for long term but is a quick route to testing

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
2017-06-02 12:58:53 -04:00
Greg Farnum
ff1258e7ef mgr: introduce tick() calls through the system
Still empty for the moment

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
2017-06-02 12:58:15 -04:00
Greg Farnum
35fd964ec0 mgr: switch from send_beacon() to tick()
We are about to want similar time-based stuff in our other
classes and it's simplest to coalesce them into a single wakeup.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
2017-06-02 12:58:15 -04:00
Greg Farnum
8d803e0483 MonClient: support "passthrough" of MonMap messages so other Dispatchers can see them
Use this in the Manager so it can notify of new monitor maps.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
2017-06-02 12:58:14 -04:00
Sage Weil
cd4acd8d01 Merge pull request #15176 from SUSE/wip-mgr-fix-help
mgr,osd:  ceph-mgr --help, unify usage text of other daemons

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-06-02 10:20:27 -05:00
Jesse Williamson
7a4ba15817 mgr: fixes compiler error because of atomic_t to <atomic>
Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
2017-06-01 15:36:29 -07:00
Sage Weil
3d7a3d7ab8 Merge pull request #14971 from SUSE/wip-mgr-py-sub-interpreter
mgr: load modules in separate python sub-interpreters

Reviewed-by: John Spray <john.spray@redhat.com>
2017-05-30 11:02:27 -05:00
Sage Weil
040fd8ce0d Merge pull request #15297 from liewegas/wip-19595
mgr/MgrStandby: prevent use-after-free on just-shut-down Mgr

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-05-27 22:10:12 -05:00
Kefu Chai
af97f164d7 Merge pull request #15111 from Liuchang0812/wip-19885-mgr-help
ceph: introduce "tell x help" subcommand

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-05-27 10:53:22 +08:00
Sage Weil
94c834ab9b Merge pull request #15272 from tchaikov/wip-mon-cleanups
mon: cleanups

Reviewed-by: Sage Weil <sage@redhat.com>
2017-05-25 22:27:11 -05:00
liuchang0812
5680936878 tool/ceph: create "tell x help" command
Fixes: http://tracker.ceph.com/issues/19885

Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
2017-05-26 10:27:26 +08:00
Brad Hubbard
096249707d Merge pull request #15192 from badone/wip-tracker-19900-wait_auth_rotating-crash
mgr: Mark session connections down on shutdown

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-05-26 08:35:29 +10:00
Sage Weil
890f482568 mgr/MgrStandby: prevent use-after-free on just-shut-down Mgr
Fixes: http://tracker.ceph.com/issues/19595
Signed-off-by: Sage Weil <sage@redhat.com>
2017-05-25 18:25:27 -04:00
Kefu Chai
983fe8ec88 mon,mgr: std::move(osd_stat) when possible
osd_stat_t could be a relatively large struct, so use std::move() when
possible

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-05-25 01:16:10 +08:00
Brad Hubbard
eb5c02df63 mgr: Mark session connections down on shutdown
Also assert in OSD::ms_get_authorizer since it is dangerous to proceed
if we are shutting down.

Fixes: http://tracker.ceph.com/issues/19900

Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
2017-05-24 14:11:32 +10:00
Tim Serong
3e0d14912e mgr: load modules in separate python sub-interpreters
This provides a reasonable amount of isolation between mgr
modules.  Notably, with this change, it's possible to have more
than one mgr module use cherrypy without conflicts.

Each MgrPyModule gets its own python sub-interpreter.  The logger,
the ceph_state module and sys.path need to be set up separately
for each sub-interpreter, so all that happens in MgrPyModule's
constructor (previously this was done on the main interpreter
in PyModules::init()).

Each sub-interpreter has its own python thread state.  The main
interpreter also has a python thread state, but that is almost
unused except for during setup and teardown of the whole beast.

On top of that, an additional python thread state is necessary
for each OS thread that calls into python code (e.g. the serve()
method).

Some care needs to be taken to ensure that the right thread state
is active at the right time; note how the call to handle_pyerror()
in PyModules::init() had to be moved inside MgrPyModle::load().
PyModules should be using the main thread state, and MgrPyModule
should usually be using its sub-interpreter thread state, except
for very early in its constructor (before the sub-interpreter has
been created), and in the serve() method where another python
thread state is created to map to the separate OS thread that is
responsible for invoking this method.

The ceph_state module (PyState.cc) naturally has no idea what
context it's being run in, so uses PyThreadState_Get() when it
needs to know the python thread state.

Signed-off-by: Tim Serong <tserong@suse.com>
2017-05-22 16:52:49 +10:00
Tim Serong
f36b0d9d40 mgr: use new Gil class in place of PyGILState_*() API
Prep work for loading modules in separate python sub-interpreters.
According to the Python C API docs, mixing the PyGILState_*() API
with sub-interpreters is unsupported, so I've replaced these calls
with a Gil class, which will acquire and release the GIL against
a specific python thread state.

Note the manual python thread state creation in MgrPyModule::serve().
The PyGILState_*() APIs would have done that for us, but we're not
using them anymore, so have to do it by hand (see
https://docs.python.org/2/c-api/init.html#non-python-created-threads
for some description of this).

Signed-off-by: Tim Serong <tserong@suse.com>
2017-05-22 16:52:48 +10:00
Tim Serong
6135c97d7b mgr: add generic --help output
Creating an MgrStandby in order to call its usage() method has
two problems:

1) MgrStandby wants to connect to a running cluster; if the
   cluster isn't up, you'll be left staring at a blinking cursor.
2) MgrStandby::usage() doesn't print anything anyway.

This commit takes pretty much the same approach to printing
usage information as ceph_mon.cc, ceph_osd.cc and ceph_mds.cc.

Signed-off-by: Tim Serong <tserong@suse.com>
2017-05-19 22:19:58 +10:00
Dan Mick
dc15cd6075 mgr: change config_prefix to be 'mgr/<id>/' and separate handle/key by '/'
dm_crypt config-key usage has established '/' as the separator; keep
that as a convention for now

Signed-off-by: Dan Mick <dan.mick@redhat.com>
2017-05-18 22:09:08 -07:00
Dan Mick
987211a639 mgr/PyModules: move constructor definition to .cc
Otherwise, the incomplete ServeThread type causes problems
for others who include PyModules.h

Signed-off-by: Dan Mick <dan.mick@redhat.com>
2017-05-18 22:09:08 -07:00
Dan Mick
f2d29d2cef mgr/PyModules.cc,PyState.cc: improve config access debug logging
Signed-off-by: Dan Mick <dan.mick@redhat.com>
2017-05-18 22:09:07 -07:00
Dan Mick
f4bc4f64ad ServeThread: add 'running' flag, don't notify non-running threads
Signed-off-by: Dan Mick <dan.mick@redhat.com>
2017-05-18 22:09:07 -07:00
Sage Weil
16cce5a56b Merge pull request #14967 from tchaikov/wip-faster-cull
mgr: optimize DaemonStateIndex::cull() a little bit

Reviewed-by: John Spray <john.spray@redhat.com>
2017-05-17 10:28:49 -05:00
Sage Weil
9af1a1eba1 Merge pull request #14937 from SpandanKumarSahu/bug#17453
mgr: remove non-existent MDS daemons from FSMap

Reviewed-by: Kefu Chai <kchai@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
2017-05-10 07:21:02 -05:00
Kefu Chai
2b8961c973 mgr: do the shutdown in the right order
Fixes: http://tracker.ceph.com/issues/19813
Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-05-06 22:45:16 +08:00
Kefu Chai
260fea0f59 mgr: do not use pointers for MgrStandby members
it's simpler and easier to manage the life cycle of them this way.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-05-06 22:45:16 +08:00
Spandan Kumar Sahu
6f10373b7a mgr: remove non-existent MDS daemons from FSMap
Fixes: http://tracker.ceph.com/issues/17453
Signed-off-by: Spandan Kumar Sahu <spandankumarsahu@gmail.com>
2017-05-05 16:54:58 +05:30
Kefu Chai
0e7137aa6a mgr: optimize DaemonStateIndex::cull() a little bit
if the size of the cluster is quite large, we don't need to walk through
all daemons to do the cull.

* smaller scope protected by the lock
* check smaller range in "all"
* use vector<string> for holding victims: all of them are of
  "daemon_type".

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-05-05 15:51:46 +08:00
John Spray
3746e209d8 mgr: embed Client instance for mds_command
Now plugins can talk to MDS daemons.

Signed-off-by: John Spray <john.spray@redhat.com>
2017-05-03 13:37:52 +08:00
John Spray
07cae6214b mgr: add get_context() to python interface
For modules that would like a CephContext* inside
a capsule, suitable for passing to librados constructor.

Signed-off-by: John Spray <john.spray@redhat.com>
2017-05-03 10:37:17 +08:00
John Spray
954c0b9c90 mgr: expose tell (MMonCommand) functionality
To enable plugins to talk directly to daemons when they
want to.

Signed-off-by: John Spray <john.spray@redhat.com>
2017-05-03 10:37:17 +08:00
John Spray
562089d2a1 mgr: expose Objecter to PyModules
Same motivation as exposing MonClient: so that modules
can get at the command sending code.

Signed-off-by: John Spray <john.spray@redhat.com>
2017-05-03 10:37:17 +08:00
Sage Weil
83c45ad6a4 osd: stop MgrClient callbacks on shutdown
Stop the MgrClient callbacks to report PG stats at the
start of shutdown() so that we don't get a callback
during/after we are done shutting down.

Protect the cb update with the MgrClient's lock so that
we don't race with MgrClient::send_report() itself.

Fixes: http://tracker.ceph.com/issues/19638
Signed-off-by: Sage Weil <sage@redhat.com>
2017-05-01 10:33:36 -04:00
John Spray
f79ae2504a mgr: fix message refcounting
Let's be consistent and push the m->put down into
the handle_(M<class>* m) functions the way
we do in the rest of the codebase.

Signed-off-by: John Spray <john.spray@redhat.com>
2017-04-30 10:30:03 +08:00
John Spray
b1e5d492d6 mgr: fix deadlock in dispatch
Signed-off-by: John Spray <john.spray@redhat.com>
2017-04-30 10:30:03 +08:00
John Spray
e7060410f7 mgr: get fresh maps on second load of Mgr
I think we got away with this when Client::init was
re-initialising the MonClient, but now that (bogus)
stuff isn't happening any more as Client doesn't
init/teardown monc/objecter itself.

Signed-off-by: John Spray <john.spray@redhat.com>
2017-04-30 10:23:14 +08:00
John Spray
9988a564d8 mgr: improve handle_command
Run the python module calls in a finisher so that
they don't block the daemonserver lock and so that
they can call back into mgr stuff if they need to.

Fix passing through commands to python modules, this
was giving EINVAL because only things with a MgrCommand
were getting let in.

Also fix get_command_descriptions, which was not
including the output of the formatter in the response.

Signed-off-by: John Spray <john.spray@redhat.com>
2017-04-30 10:21:30 +08:00
Sage Weil
92b6227fcf Merge pull request #14161 from jcsp/wip-mgr-legacy-mds
mgr: fix metadata handling from old MDS daemons

Reviewed-by: Sage Weil <sage@redhat.com>
2017-04-28 16:43:41 -05:00
Sage Weil
22ef06db64 Merge pull request #14706 from SUSE/wip-fix-19629
mgr: fix crash on set_config from python module with insufficient caps

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-04-28 16:41:27 -05:00
Yuri Weinstein
75c1818f1e Merge pull request #14835 from tchaikov/wip-19743
mgr: do shutdown using finisher so we can do it in the right order

Reviewed-by: Sage Weil <sage@redhat.com>
2017-04-28 08:34:19 -07:00
Sage Weil
40699a61b2 Merge pull request #14802 from tchaikov/wip-mgr-cleanup
mgr: various cleanups

Reviewed-by: Sage Weil <sage@redhat.com>
2017-04-27 11:43:32 -05:00
Kefu Chai
145acbe976 mgr: do shutdown using finisher so we can do it in the right order
otherwise we can shutdown a PyModules while it still being init'ed

Fixes: http://tracker.ceph.com/issues/19743
Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-04-27 22:16:41 +08:00
Kefu Chai
7ec86ca55e mgr/MgrPyModule: no need to keep pClass and pModule around
Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-04-26 18:08:07 +08:00
Kefu Chai
67072d2261 mgr: pass python interpreter's path to embedded python
* also do prevent python from registering its own signal handler, it does
  not make sense in our embedded use case.
* pass python interpreter's path to embedded python before initializing
  it. python uses this path to look up the "site" modules, etc.

so it can use other interpreter if it is not intalled into $PATH,
otherwise the "python" in $PATH will always be used even the
PYTHON_EXECUTABLE in CMake's cache is pointing to another python
interpreter.

if one want to debug ceph-mgr with a customize build python, this would
be helpful.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-04-26 18:08:07 +08:00
Sage Weil
4b1d6b05d2 osd/OSDMap: move to 'osdmap' mempool
We leave a few things out:

- strings (to annoying, and they are small)
- erasure code profiles (ditto)

Signed-off-by: Sage Weil <sage@redhat.com>
2017-04-25 09:11:50 -04:00
Tim Serong
1dc66c4aeb mgr: fix crash on set_config from python module with insufficient caps
If config-key put fails, we now log the failure rather than asserting that
it must always succeed.

Fixes: http://tracker.ceph.com/issues/19629
Signed-off-by: Tim Serong <tserong@suse.com>
2017-04-24 20:15:02 +10:00
Sage Weil
56bff03b50 Merge pull request #14189 from tchaikov/wip-mgr-py-stderr
mgr: redirect python stdout,stderr to ceph log

Reviewed-by: John Spray <john.spray@redhat.com>
2017-04-21 18:54:01 -05:00
Sage Weil
27dd6530a2 Merge pull request #14559 from liewegas/wip-pg-map
mon: move 'pg map' to OSDMonitor

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-04-21 18:53:17 -05:00
Sage Weil
7b9cd85ba3 Merge pull request #14716 from tchaikov/wip-mgr-pystring-leak
mgr: release allocated PyString

Reviewed-by: John Spray <john.spray@redhat.com>
2017-04-21 13:18:01 -05:00
Sage Weil
e12396cd7c mgr/MgrSession: allow ref tracing, and fix ref leak
The first RefCountedObj ctor arg is a cct, not a ref count.

Fixes: http://tracker.ceph.com/issues/19591
Signed-off-by: Sage Weil <sage@redhat.com>
2017-04-21 14:15:09 -04:00
Kefu Chai
2005ce83ad mgr: release allocated PyString
Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-04-21 22:36:34 +08:00
Kefu Chai
cef433eccb mgr: move handle_pyerror() from MgrPyModules to MgrPyModule
so we can reuse it in a more sane way.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-04-21 14:39:44 +08:00
Dan Mick
8c249e4b2b mgr/MgrPyModule::handle_command: order stringstreams to match intent
ds is intended for command output (like stdout), to be shown/saved
when there's no error returned; ss is for error status (like stderr)
to further explain the error.  mgr Python tracebacks should go to
the latter.

Signed-off-by: Dan Mick <dan.mick@redhat.com>
2017-04-21 14:17:09 +08:00
Dan Mick
6fc3a46295 mgr/PyModules handle_pyerror: don't add extra newlines to tb
Signed-off-by: Dan Mick <dan.mick@redhat.com>
2017-04-21 14:17:09 +08:00
Dan Mick
71a9856233 mgr/MgrPyModule.cc: get Python traceback in all CallMethod spots
Signed-off-by: Dan Mick <dan.mick@redhat.com>
2017-04-21 14:17:09 +08:00
Tim Serong
3d3ee4bf76 mgr: log module name before PyErr_Print()
If an exception is raised in any of the python module functions
invoked by mgr (for example, ImportError if rest_framework isn't
available when serve() in called in the rest module), print the
module name along with the failed method name.

This commit also fixes what looks to me like a missed call to
PyGILState_Release() in the failure case in MgrPyModule::serve().

Signed-off-by: Tim Serong <tserong@suse.com>
2017-04-21 14:17:09 +08:00
Kefu Chai
f50d9f799d mgr: redirect python stdout,stderr to ceph log
PyErr_Print() uses a file object "stderr" for printing messages.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-04-21 14:17:09 +08:00
John Spray
8ce30bc4cd mgr: fix metadata handling from old MDS daemons
In abde684 we started always fetching metadata on fsmap changes
for legacy daemons (i.e. those without addr fields) -- this works
but is very inefficient.

By injecting an 'addr' field based on the address in
the FSMap, if the field is missing, we can reload
metadata only on daemon restarts.

Signed-off-by: John Spray <john.spray@redhat.com>
2017-04-20 16:41:15 +01:00
John Spray
838f66269f mgr: fix waiting for module shutdown() before destroying
Fixes: http://tracker.ceph.com/issues/19412
Signed-off-by: John Spray <john.spray@redhat.com>
2017-04-20 15:00:30 +01:00
John Spray
4c59fedb48 mgr: fix MgrPyModule destruction
Fixes: http://tracker.ceph.com/issues/19412
Signed-off-by: John Spray <john.spray@redhat.com>
2017-04-20 14:59:50 +01:00
Yuri Weinstein
82c0ea7c99 Merge pull request #14431 from liewegas/wip-mgrclient-leak
mgr/MgrClient: fix reconnect event leak

Reviewed-by: John Spray <john.spray@redhat.com>
Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-04-18 10:04:50 -07:00
Yuri Weinstein
721929d60c Merge pull request #14507 from tchaikov/wip-19590
mgr: always free allocated MgrPyModule

Reviewed-by: Sage Weil <sage@redhat.com>
Reviewed-by: John Spray <john.spray@redhat.com>
2017-04-18 10:01:47 -07:00
John Spray
1247119ca8 Merge pull request #14046 from songbaisen/m7
mgr: optimization some judgment and adjust the debug remove value in register_new_pgs

Reviewed-by: John Spray <john.spray@redhat.com>
2017-04-17 11:23:22 +01:00
songbaisen
3da07ea0a5 mgr: optimization some judgment and adjust the debug remove value in register_new_pgs
Signed-off-by: song baisen <song.baisen@zte.com.cn>
2017-04-17 06:53:26 +00:00
Sage Weil
2d15ba7d14 mgr/MgrClient: fix reconnect event leak
Signed-off-by: Sage Weil <sage@redhat.com>
2017-04-16 13:28:23 -04:00
Sage Weil
8720ed5124 mon: move 'pg map' to OSDMonitor (from PGMap)
1. this belongs on the mon, operating against the latest
osdmap.
2. it shouldn't go in PGMonitor because that is about to
be turned off.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-04-14 14:16:50 -04:00
Kefu Chai
dc7ff92e52 mgr: always free allocated MgrPyModule
use unique_ptr to manage the lifecycle of MgrPyModule and ServeThread,
it's easier and safer. without this chance, we don't free allocated
MgrPyModule if it fails to load().

Fixes: http://tracker.ceph.com/issues/19590
Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-04-13 23:58:43 +08:00
Kefu Chai
9acd868857 Merge pull request #14404 from tchaikov/wip-another-mgr-command
mon,mgr: move reweight-by-* to mgr

Reviewed-by: Sage Weil <sage@redhat.com>
2017-04-13 13:57:42 +08:00
Dan van der Ster
44354e0089 ceph-mgr: reopen logs on SIGHUP
Wire up the sighup_handler to reopen logs, like the other daemons.

Fixes: http://tracker.ceph.com/issues/19568
Signed-off-by: Dan van der Ster <daniel.vanderster@cern.ch>
2017-04-10 17:29:05 +02:00
Kefu Chai
6646b35ac7 mgr,mon,osdc: more constness
Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-04-10 23:20:16 +08:00
Kefu Chai
c14b913bad mgr/DaemonServer: always template the return value
Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-04-10 23:20:16 +08:00
Kefu Chai
4a8631e5b0 mgr/DaemonServer: move reweight-by-* to mgr
Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-04-10 23:20:16 +08:00
Kefu Chai
63ab319875 mgr/DaemonServer: extract reply out of handle_command()
Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-04-10 23:20:16 +08:00
Sage Weil
5b8ea86c0f Merge pull request #14365 from tchaikov/wip-another-mgr-command
mgr: move "osd pool stats" to mgr

Reviewed-by: Sage Weil <sage@redhat.com>
2017-04-08 09:22:13 -05:00
Sage Weil
b6fdd605e8 Merge pull request #14374 from liewegas/wip-mgr-init
mgr: fix bugs in init, beacons

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-04-07 13:47:48 -05:00
Kefu Chai
5624b19099 Merge pull request #14366 from wjin/clean_mgr
mgr: remove unused function declarations

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-04-07 16:16:37 +08:00
Sage Weil
abfb057334 mgr/Mgr: unlock lock while blocking for metadata load
Fixes: http://tracker.ceph.com/issues/19516
Signed-off-by: Sage Weil <sage@redhat.com>
2017-04-06 11:40:27 -04:00
Sage Weil
1d465facb4 Merge pull request #14328 from liewegas/wip-mgrmap-features
mgr: fix several init/re-init bugs

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-04-06 10:14:09 -05:00
Wei Jin
3f514bda1c mgr: clean nonused function declaration
Signed-off-by: Wei Jin <wjin.cn@gmail.com>
2017-04-06 19:11:17 +08:00
Kefu Chai
db9e5312e8 mgr: move "osd pool stats" to mgr
Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-04-06 19:01:58 +08:00
Sage Weil
6f8cd66b94 Merge pull request #14303 from liewegas/wip-more-mgr-commands
mgr: move 'osd perf' and 'osd blocked-by' to mgr

Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-04-05 08:55:03 -05:00
Sage Weil
f2a44f4160 mgr/Mgr: log something at end of handle_mgr_digest
Saw a run that showed the notify_all pg_summary as the last
message for this thread; hopefully we can see if it is
blocked in notify_all() or not.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-04-04 16:05:23 -04:00
Sage Weil
025934423f mgr/Mgr: drop lock while fetching config-keys
This avoids a deadlock if some other message arrives before
the command reply and needs to take the mgr lock in dispatch.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-04-04 15:59:05 -04:00
Sage Weil
6d5e0132d9 mgr/Mgr: fix map waits in init
If we go active multiple times we may already have an fsmap
subscription registered via MonClient, which means that we
won't receive a net new FSMap during the init phase.  This is
trivial to reproduce; just 'ceph mgr fail x' and when it
activates the second time init() will get stuck waiting.

The core issue is that monc subs are stateful, but we forget
the various maps with the previous Mgr incarnation.  Sipmle
workaround is to reset the mon connection as we init.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-04-04 14:27:54 -04:00
Sage Weil
1113eb123b mgr/Mgr: use cond (not context) for FSMap wait
This is simpler.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-04-04 14:27:41 -04:00
Wei Jin
3f857b9ae4 mgr: rm nonused main function
Signed-off-by: Wei Jin <wjin.cn@gmail.com>
2017-04-04 17:47:56 +08:00
Sage Weil
bd4ba40b9e mgr: move 'osd perf' and 'osd blocked-by' to mgr
Signed-off-by: Sage Weil <sage@redhat.com>
2017-04-03 12:46:32 -04:00