...and change the "if False" django-rest-framework
conditionals to actual version checks, with a view
to genuinely supporting 2.x in future if needed.
Signed-off-by: John Spray <john.spray@redhat.com>
This broken when MgrStandby was separated out,
because it now eats the original OSDMap message
without calling maybe_request_map.
Signed-off-by: John Spray <john.spray@redhat.com>
This used to be the friend relationship to PGMonitor. It
was never really needed anyway, it was only being used
to skip the getter on `pools`
Signed-off-by: John Spray <john.spray@redhat.com>
...and remove the copypasta from mgr.
mgr still doesn't do all the same logic (it doesn't
have osdmap history handy) but it is now much easier
to see which bits are used one place vs. the other.
Signed-off-by: John Spray <john.spray@redhat.com>
A demonstration of creating a simple
ASCII-art status display by fusing
the metadata, perf counters, and maps that
are available to python modules in ceph-mgr.
Signed-off-by: John Spray <john.spray@redhat.com>
Previously only the errors were getting through, because
other stuff was getting held up in the python logging
framework.
Signed-off-by: John Spray <john.spray@redhat.com>
This is a rough implementation that sends all the stats,
without the efficiency of the queue+acks that we use
when talking to the mon.
Signed-off-by: John Spray <john.spray@redhat.com>
The send_report loop doesn't get kicked off
on configure messages unless the period is
set to its initial value (0).
Signed-off-by: John Spray <john.spray@redhat.com>
The ceph_state module is implemented in C++, and isn't available at
build time, which causes import failures when api_docs.py tries to
import calamari_rest in order to introspect it (MgrModule is eventually
imported, which in turn tries to import ceph_state, which fails unless
we stub it out).
Additional changes:
* Search calamari_rest.urls (not calamari_web)
calamari_web isn't available - it largely held static content in
Calamari, and in turn included calamari_rest.urls. Here in ceph-mgr we
only have calamari_rest.
* note that --list-urls does nothing, apparently
* Pass actions to old as_view method
django-rest-framework 3.x raises TypeError if the actions argument isn't
passed to as_view().
* Use view().get_view_name() instead of metadata
Attempting to access view().metadata(None)['name'] results in
"AttributeError: 'super' object has no attribute 'metadata'".
* Use somewhat unfriendly field class names
django-rest-framework 3.x seems to have done away with type_label for
fields, so instead use the field's class name, which is somewhat
unfriendly, but arguably better than nothing.
* import global_instance to fix ImportError
This is necessary to avoid what seems to be weird import loops (if this
isn't present, we later get "ImportError: cannot import name
UserRequest" or similar).
* Make api_examples.json optional
This way we at least get bare docs with no examples, rather than no docs
at all.
* Explain how to generate API docs
Signed-off-by: Tim Serong <tserong@suse.com>
This is "tell mgr" at the moment but it should
be a slicker syntax later (ceph.in is awkward
to refactor just now)
Signed-off-by: John Spray <john.spray@redhat.com>
...and store the list by a string path, for
consumption by the world outside of integer
perf counter/subsystem IDs.
This is for consumption by MgrClient.
Signed-off-by: John Spray <john.spray@redhat.com>