Hector Martin [Wed, 2 Dec 2015 13:34:41 +0000 (22:34 +0900)]
pybind: Improvements to Cython build
- Avoid a silly rebuild at install time by always using src/build explicitly as build dir
- Tell Cython to put rbd.c in the build dir instead of in the source
This should fix a race when librbd gets relinked at the same time as pybind is installed
(since that install was causing a rebuild too).
Hector Martin [Tue, 1 Dec 2015 14:30:01 +0000 (23:30 +0900)]
pybind: convert librbd bindings to Cython
ctypes is fundamentally incapable of providing safe callback support
(exceptions during callbacks are not handled properly). To fix this, and also
gain more flexibility, rewrite/port the librbd bindings to Cython instead.
Other Python bindings are expected to migrate to Cython in the future.
Reference: http://tracker.ceph.com/issues/13115
To support this, this change also:
- Introduces a Makefile for pybind which calls setup.py
- Updates the installation files for packages
- Adds a hack to admin/build-doc to build a dummy librbd, avoiding the need to
build the entire client library just to generate documentation (Sphinx needs
to be able to import rbd.so, which depends on librbd.so symbols).
With contributions by Josh Durgin <jdurgin@redhat.com>
Hector Martin [Tue, 1 Dec 2015 14:28:17 +0000 (23:28 +0900)]
debian/control: make python-rbd depend on minimum librbd version
As the Cython bindings build to a binary module, backwards compatibility with
older librbd ABIs at runtime is not possible, so depend on at least the same
version (or newer).
Hector Martin [Tue, 1 Dec 2015 14:25:33 +0000 (23:25 +0900)]
Makefile: break out local targets into variables
To support more than one set of local-* rules, break them out into
sub-rules referenced by appending to variables. This will be used
when introducing the Cython-based librbd bindings that rely on
setup.py
Hector Martin [Tue, 1 Dec 2015 14:20:01 +0000 (23:20 +0900)]
configure/packaging: introduce Cython dependency
To prepare for the migration of rbd.py to Cython, add Cython as a package
dependency and have the configure script look for it.
Also adds Cython as a dependency for admin/build-doc, and changes the
virtualenv to allow usage of system packages (to avoid having to compile
Cython inside the virtualenv).
With contributions by Josh Durgin <jdurgin@redhat.com>
Loic Dachary [Tue, 1 Dec 2015 13:28:05 +0000 (14:28 +0100)]
doc: INSTALL redirect to online documentation
The INSTALL file has obsolete and misleading instructions to compile
from sources (-pg actually fails at link time). Replace with links to
the online installation and build from source documentations.
Haomai Wang [Mon, 9 Nov 2015 15:05:01 +0000 (23:05 +0800)]
librbd: Remove unneeded set_event_notify
Since xlist clear method invoked below is enough to disassociate the xlist
item from the xlist, so the remove_myself() call in the destructor is safe
to invoke since it's already been removed from the list.
Ilya Dryomov [Sun, 29 Nov 2015 20:46:41 +0000 (21:46 +0100)]
rbd: bail if too many arguments provided
The code has a catch clause for that, but it was being rendered useless
by the preceding
if (command_spec.size() > matching_spec->size())
positional_options.add(at::POSITIONAL_ARGUMENTS.c_str(), -1);
which names all (both expected and extraneous) positional arguments.
Change it to name only expected arguments, deriving the number of
expected arguments from the length of positional_opts vector, supplied
by each action. This works for all actions except "feature enable" and
"feature disable" which are specified as multitoken, so keep on passing
in -1 for those.
Ilya Dryomov [Mon, 30 Nov 2015 15:36:43 +0000 (16:36 +0100)]
tests: update unmap.t CLI test
Fixup the exit code - the old CLI tried to differentiate between CLI
errors and action errors by returning EXIT_FAILURE in the former case.
Also remove a test that relied on a special case check in the old CLI.
Ilya Dryomov [Mon, 30 Nov 2015 15:29:56 +0000 (16:29 +0100)]
cmake: librbd needs libjournal and libcls_journal_client
Commit 4719696cadd1 ("cmake: updates for refactored librbd IO path")
fixed file lists but missed the link dependency - librbd now needs
libjournal and libcls_journal_client.
Chengyuan Li [Fri, 20 Nov 2015 05:29:39 +0000 (22:29 -0700)]
mon/PGMonitor: MAX AVAIL is 0 if some OSDs' weight is 0
In get_rule_avail(), even p->second is 0, it's possible to be used
as divisor and quotient is infinity, then is converted to an integer
which is negative value.
So we should check p->second value before calculation.
Josh Durgin [Thu, 26 Nov 2015 05:37:23 +0000 (21:37 -0800)]
pybind: decode empty string in conf_parse_argv() correctly
cretargs is a array of c_char_p, which means ctypes has already
converted it to python byte strings. decode_cstr() would misinterpret
the empty string as a NULL c_char_p(), and convert it to None by
accident, resulting in errors when running commands like
'ceph config-key put foo ""'.
Since this is the only place we use arrays of c_char_p, just decode
it directly in conf_parse_argv(). Tested with python 2 and 3.
Loic Dachary [Sat, 28 Nov 2015 16:55:46 +0000 (17:55 +0100)]
tests: fix race condition testing auto scrub
When testing auto scrub, waiting 20 seconds for the scrub to complete is
sometimes not enough and creates false negatives.
Split wait_for_scrub out of the repair helper so that it can be used to
wait for the scrub to happen instead of using a timer.
The scrub timestamp is obtained after removing the object, therefore
there is a chance for the scrub to be finished already. But since auto
scrub is scheduled every 5 seconds, it will only make the test wait an
extra 5 seconds and not hang forever.
http://tracker.ceph.com/issues/13592
Signed-off-by: Xinze Chi <xinze@xsky.com> Signed-off-by: Loic Dachary <loic@dachary.org>
osd: store per pool scrub intervals in pool options
ceph osd pool set $POOL scrub_min_interval N
ceph osd pool set $POOL scrub_max_interval N
ceph osd pool set $POOL deep_scrub_interval N
If N > 0, this value is used for the pool instead of
the corresponding global parameter from the config
(osd_scrub_min_interval, osd_scrub_max_interval or
osd_deep_scrub_interval).
Josh Durgin [Thu, 26 Nov 2015 05:37:23 +0000 (21:37 -0800)]
pybind: decode empty string in conf_parse_argv() correctly
cretargs is a array of c_char_p, which means ctypes has already
converted it to python byte strings. decode_cstr() would misinterpret
the empty string as a NULL c_char_p(), and convert it to None by
accident, resulting in errors when running commands like
'ceph config-key put foo ""'.
Since this is the only place we use arrays of c_char_p, just decode
it directly in conf_parse_argv(). Tested with python 2 and 3.