Commit Graph

29000 Commits

Author SHA1 Message Date
Loic Dachary
bfd4db2525 ceph_argparse: unit tests for validate_command config-key
http://tracker.ceph.com/issues/6274 refs #6274

Reviewed-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:44 +02:00
Loic Dachary
fa396d9461 ceph_argparse: unit tests for validate_command osd
http://tracker.ceph.com/issues/6274 refs #6274

Reviewed-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:44 +02:00
Loic Dachary
c09d01c210 ceph_argparse: unit tests for validate_command mon
http://tracker.ceph.com/issues/6274 refs #6274

Reviewed-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:44 +02:00
Loic Dachary
0ff003065c ceph_argparse: unit tests for validate_command mds
http://tracker.ceph.com/issues/6274 refs #6274

Reviewed-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:44 +02:00
Loic Dachary
00d15049ea ceph_argparse: unit tests for misc validate_command
Contrary to all other classes, this series of command ( Monitor ) does
not have a common prefix.

http://tracker.ceph.com/issues/6274 refs #6274

Reviewed-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:44 +02:00
Loic Dachary
253e53f41a ceph_argparse: unit tests for validate_command auth
http://tracker.ceph.com/issues/6274 refs #6274

Reviewed-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:44 +02:00
Loic Dachary
d3bf39e761 ceph_argparse: unit tests for validate_command pg
http://tracker.ceph.com/issues/6274 refs #6274

Reviewed-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:44 +02:00
Loic Dachary
1d54754c48 pybind: ceph_argparse unit tests foundations
The general idea is to have a series of commands, in the same order as
they show in mon/MonCommands.h, as if they were input to the ceph
client. For each command a valid combination is verified. And at least
one validation error is checked to produce a validation error. For
instance:

    ['pg', 'stat']

is a valid command and the validate_command function is expected to
return a value that is not None or {}. The command

    ['pg', 'stat', 'toomany' ]

is also given to validate_command to check that an error occurs when
an extra argument is given.

The TestArparse class implements a few methods to reduce the verbosity
of the tests. It does not provide many methods : only those that
significantly reduce the verbosity have been implemented. The drawback
of writing too many convenience methods is that they are more difficult
to read and maintain.

The signature dictionary is made a global variable so that
it is only extracted once for all classes. It is immutable.

http://tracker.ceph.com/issues/6274 refs #6274

Reviewed-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:44 +02:00
Loic Dachary
f9c7bc697c pybind: catch EntityAddress missing /
If the / is missing in an EntityAddress, an ArgumentValid exception must
be raised so that it can be caught in the same way other argument
validation exceptions are.

http://tracker.ceph.com/issues/6274 refs #6274

Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:43 +02:00
Loic Dachary
ccf2200841 mon: validate mon dump epoch as a positive integer
All other epochs are validated in the same way

http://tracker.ceph.com/issues/6274 refs #6274

Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:43 +02:00
Loic Dachary
8f0bb2f02f pybind: unit tests for ceph_argparse::parse_json_funcsigs
Run parse_json_funcsigs against the builtin commands found
in mon/MonCommands.h. Although it does not provide for a full
validation, it will detect some degenerate cases.

It is expected to raise if a space is missing at the end of an option
specification ( see https://github.com/ceph/ceph/pull/585 ) and this
case is tested. New tests of the same kind can be added whenever an
undetected error is found. Ideally a validation function is implemented
and it would be updated ( with an associated test ) when a new
pathological case is found.

The json string given to parse_json_funcsigs is obtained from
the support program get_command_descriptions.

The python-nose dependencies are added to the build requirements in
debian/control and ceph.spec.in because make check should always be run
at built time.

http://tracker.ceph.com/issues/6274 refs #6274

Reviewed-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:43 +02:00
Loic Dachary
96067e0784 .gitignore gtags(1) generated files
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:43 +02:00
Loic Dachary
c16b54fd53 mon: get_command_descriptions support program
The get_command_descriptions function is not designed to be tested in
C++ because all the validation happens in pybind/ceph_argparse.py. The
get_command_descriptions program is designed to be used by python unit
tests as a mean to get a JSON dump of the content of mon/MonCommands.h

      get_command_descriptions --all

      {"cmd000":{"sig":["pg","stat"],"help": ... "avail":"cli,rest"}}

It also provides a way to reproduce and keep track of past errors
( typos etc. ) to ensure the python validation keeps catching it.

      get_command_descriptions --pull585

Add /get_command_descriptions to .gitignore so that

      git ls-files --exclude-standard --others

does not see it which is required for
f018d220f2/build-ceph.sh (L73)

http://tracker.ceph.com/issues/6274 refs #6274

Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:43 +02:00
Loic Dachary
e0b5697387 mon: convenience function to convert commands to json
The get_command_descriptions is added to Monitor.h and contains
the code previously inlined in Monitor::handle_command to implement
the get_command_descriptions command. It is intended for tests to
convert command descriptions into json, including error cases.

http://tracker.ceph.com/issues/6274 refs #6274

Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:43 +02:00
Loic Dachary
9c9d7e6a32 autotools: set noinst_PROGRAMS
to be used by unit test support programs that do not need to be installed

Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:43 +02:00
Loic Dachary
ee33ff81f8 autotools: group test scripts in check_SCRIPTS
The check_SCRIPTS is added in Makefile-env.am to list the tests that do
not require compilation. The scripts listed in check-local and in the
TESTS variable use check_SCRIPTS instead.

The PYTHONPATH environment variable is added to Makefile-env.am and
includes the pybind directory so that python unit tests can load the
libraries from sources.

http://tracker.ceph.com/issues/6274 refs #6274

Reviewed-by: Roald J. van Loon <roaldvanloon@gmail.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-23 23:46:43 +02:00
Loic Dachary
0eb0c3e0f3 Merge pull request #626 from ceph/wip-usage
common/config: include --cluster in default usage message
2013-09-23 14:25:15 -07:00
Sage Weil
da42355a6d Merge pull request #599 from ceph/wip-6323
mon: OSDMonitor: fix #6322 and #6323

Reviewed-by: Greg Farnum <greg@inktank.com>
2013-09-23 14:12:33 -07:00
Sage Weil
104277c836 Merge pull request #617 from dachary/wip-lfnindex
os: fix TestLFNIndex test warnings

Reviewed-by: Sage Weil <sage@inktank.com>
2013-09-23 14:11:36 -07:00
Sage Weil
157754b3a0 common/config: include --cluster in default usage message
Clean it up a bit too.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-09-23 14:10:36 -07:00
Sage Weil
679f520781 Merge pull request #624 from ceph/automake-fix-common
make: build common/secret only on linux

Reviewed-by: Sage Weil <sage@inktank.com>
2013-09-23 14:07:22 -07:00
David Zafman
362dba1086 os, ceph_osd: Rename on_disk_version to target_version
Signed-off-by: David Zafman <david.zafman@inktank.com>
2013-09-23 13:12:41 -07:00
David Zafman
7b7e004611 os: Prior version bump should have updated this
Version available as argument, so use instead of constant

Caused by dab238b0fb

Signed-off-by: David Zafman <david.zafman@inktank.com>
2013-09-23 13:11:31 -07:00
Noah Watkins
27fb44b358 make: build common/secret only on linux
libkeyutils is only available on linux. before the automake refactoring
secret.c was compiled into rbd and ceph_mount targets which are linux
only targets. secret.c was moved to libcommon during the refactoring,
but the conditional compilation was lost.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2013-09-23 13:07:12 -07:00
David Zafman
8407669e42 os: Code conformance of os/LFNIndex.cc
Signed-off-by: David Zafman <david.zafman@inktank.com>
2013-09-23 11:57:10 -07:00
David Zafman
0d47bf8ace os: Fix typo in comment
Signed-off-by: David Zafman <david.zafman@inktank.com>
2013-09-23 11:57:10 -07:00
David Zafman
c4bcb469ad common: Fix get_namespace() definition in hobject_t
Signed-off-by: David Zafman <david.zafman@inktank.com>
2013-09-23 11:57:10 -07:00
David Zafman
1c0aecbe4a osd: Add assert() on collection_getattr() failure instead of later decode crash
Signed-off-by: David Zafman <david.zafman@inktank.com>
2013-09-23 11:57:09 -07:00
David Zafman
0655cc156f tools: Fix ceph_filestore_dump usage again
Signed-off-by: David Zafman <david.zafman@inktank.com>
2013-09-23 11:57:09 -07:00
Sage Weil
9adb73ae41 Merge pull request #618 from dachary/wip-jerasure-minimum-to-decode
ErasureCode: minimum_to_decode unit tests and optimization

Reviewed-by: Sage Weil <sage@inktank.com>
2013-09-23 10:53:54 -07:00
Sage Weil
5bc4610855 Merge pull request #605 from dachary/wip-erasure-code-plugin-test
erasure code plugin test
2013-09-23 10:27:47 -07:00
Sage Weil
10f291838e Merge pull request #603 from dachary/wip-erasure-code-example
erasure code example cleanup
2013-09-23 10:26:48 -07:00
Sage Weil
b683005c21 Merge pull request #607 from ceph/prctl-getname-test
code_env: use feature test for PR_GET_NAME support

Reviewed-by: Sage Weil <sage@inktank.com>
2013-09-23 10:14:07 -07:00
Sage Weil
6b745c9491 Merge pull request #616 from ceph/automake-flags
automake: fixup am_common_flags to avoid re-definitions

Reviewed-by: Roald J. van Loon <roaldvanloon@gmail.com>
2013-09-23 10:12:16 -07:00
Gregory Farnum
2299c4dbf2 Merge pull request #614 from ceph/wip-rados-model
Prevent copy_from against yourself, and fix issues with the testing framework around it

Reviewed-by: Greg Farnum <greg@inktank.com>
2013-09-23 09:55:32 -07:00
Sage Weil
10363daddb Merge remote-tracking branch 'gh/next' 2013-09-23 09:50:10 -07:00
Wido den Hollander
991139bc0d doc: When bootstrapping mon set the correct caps for client.admin
Otherwise client.admin will be privilege-less and the admin can't
access the cluster.
2013-09-23 13:52:51 +02:00
Loic Dachary
9dfac9edfe ErasureCode: minimum_to_decode unit tests and optimization
The minimum_to_decode function simply returns the available chunks if no
recovery is necessary.

Add unit tests covering all minimum_to_decode situations:

* trying to read nothing
* read a chunk if none are available
* reading a subset of the available chunks
* read a missing chunk if there is less than k chunks available.
* reading when a chunk must be recovered

Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-22 11:02:39 +02:00
Loic Dachary
9442cfaa39 os: fix TestLFNIndex test warnings
Do not ignore system return value. Wrap emacs compile line to 80
characters.

Signed-off-by: Loic Dachary <loic@dachary.org>
2013-09-22 10:46:23 +02:00
Yan, Zheng
945eb3cbfc mds: remove dirfrags when purging stray directory
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2013-09-22 14:14:20 +08:00
Yan, Zheng
7be9b92d2e mds: avoid fetching backtrace when purging stray
we save old data pools in both inode_backtrace_t::old_pools and
inode_t::old_pools. We have the inode in the cache when purging
stray, so no need to fetch backtrace to find old data pools.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2013-09-22 14:14:20 +08:00
Yan, Zheng
67386e4524 mds: don't trim stray inode from the cache.
don't trim stray inode from the cache, purge it instead. This ensures
the stary directories at minimum size.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2013-09-22 14:14:20 +08:00
Yan, Zheng
0f3ba2974f mds: remove unnecessary MDCache::maybe_eval_stray() calls
Now we call MDCache::maybe_eval_stray() in MDSCacheObject::put().
So there is no need to call MDCache::maybe_eval_stray() after
releasing inode/dentry's refernece.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2013-09-22 14:14:20 +08:00
Yan, Zheng
cbf1f3ca1e mds: evaluate stray when releasing inode/dentry's reference
Current method to purge stray inode is call MDCache::maybe_eval_stray()
after releasing a reference to the stray inode/dentry. It's difficult
to make this method work correct, because there are so many places that
can release reference.

This patch solves the issue by calling MDCache::maybe_eval_stray()
in MDSCacheObject::put(). This avoids adding code that calls
MDCache::maybe_eval_stray() to each place that releases reference.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2013-09-22 14:14:15 +08:00
Noah Watkins
0a439745c4 automake: add per-target AM_CPPFLAGS
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2013-09-21 10:41:17 -07:00
Noah Watkins
11d8d75595 makefile-env: separate cppflags and cflags usage
AM_COMMON_FLAGS included both CPP and C[XX] flags. This can cause
re-definition errors like this:

make[4]: Nothing to be done for `all-am'.
CXX      cls/version/cls_version_client.o
<command-line>: warning: "__STDC_FORMAT_MACROS" redefined

because the macro definition appears in both AM_CXXFLAGS and
AM_CPPFLAGS.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2013-09-21 10:24:04 -07:00
João Eduardo Luís
3c64784e3f Merge pull request #612 from ceph/wip-6361
perfglue/heapprofiler: expect cmd name when handling command instead of 'heap <cmd>'

This was broken by the cli rework.

Reviewed-by: Samuel Just <sam.just@inktank.com>
2013-09-21 04:40:55 -07:00
Sage Weil
2b75abbd85 ceph_test_rados: fix COPY_FROM completion
Fix the copy_from operation to not remove the objects from the in_use list
until after the entire operation is complete.  In particular, the racing
read was completing and removing the dest oid from the in-use list before
the copy-from completed.  This keeps the model in sync with what the OSD
is actually doing.

If another new read started up, it would grab the previous value from the
model and expect to see that, but would instead see the updated value.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-09-20 21:06:09 -07:00
Sage Weil
935eb22833 ceph_test_rados: fix seq_num, improve error output
Signed-off-by: Sage Weil <sage@inktank.com>
2013-09-20 20:49:55 -07:00
Sage Weil
4d0ee0b55b ceph_test_rados: limit max_in_flight to objects/2
In particular, we need to allow all in-flight ops to be COPY_FROM.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-09-20 20:44:36 -07:00