mon,osd,erasure-code: update copyright notices

Signed-off-by: Loic Dachary <loic@dachary.org>
common,erasure-code,mon: s/erasure-code-//

The parameters to erasure code do not need to be prefixed with the
erasure-code- string. There only are erasure-code parameters and the
prefix was originaly intended to desambiguate the erasure-code
properties, assuming that the properties map could be used for other
purposes.

Signed-off-by: Loic Dachary <loic@dachary.org>
erasure-code: remove dependency to the global context

Instead of relying on derr to display error messages, add them to an
ostream parameter given in argument to load() and factory(). The erasure
code convenience library no longer depends on the global context that is
indirectly referenced by debug.h

Signed-off-by: Loic Dachary <loic@dachary.org>
erasure-code: add ostream to factory()

Modify calls to ErasureCodePlugin::factory() to provide the new
ostream argument.

Signed-off-by: Loic Dachary <loic@dachary.org>
erasure-code: make libcommon include liberasure-code

So that it can be used in OSDMap which is part of libcommon.

Signed-off-by: Loic Dachary <loic@dachary.org>
osd: add OSDMap::erasure_code_profile

A map of key=value properties to be interpreted by the erasure code
plugins. For instance profile["default"] = { "k": 2, "m": 1 }

Signed-off-by: Loic Dachary <loic@dachary.org>
osd: OSDMap::erasure_code_profile accessors

For both the incremental and the OSDMap fields.

Signed-off-by: Loic Dachary <loic@dachary.org>
mon: add helper to selection functions implementing tests

The call_TEST_functions will lookup SHARE_MON_TEST_* shell functions and
run them after creating a mon. Each is expected to clean up and avoid
interferences. It will also lookup TEST_* shell functions and include them
in setup/teardown to provide them with a clean environment.

Signed-off-by: Loic Dachary <loic@dachary.org>
mon: add the {set,get} erasure_code_profile MonCommand

set erasure_code_profile parses the key=value pairs given in argument
and stores them in OSDMap::erasure_code_profile. The get
erasure_code_profile supports plain text display if the Formatter is not
set (or invalid).

  set erasure_code_profile myprofile a=b c=d

is stored as

  OSDMap::erasure_code_profile["myprofile"] = {"a":"b", "c":"d"}

Signed-off-by: Loic Dachary <loic@dachary.org>
osd: replace pg_pool_t properties with erasure_code_profile

The generic map properties is only used for erasure code and should be
specialized. It is replaced by a string that can be looked up in
OSDMap::erasure_code_profiles to retrieve the key/value pairs that will
be interpreted by the erasure code plugin.

There is no upgrade path because properties is not found in any Ceph
release.

Signed-off-by: Loic Dachary <loic@dachary.org>
mon: OSDMonitor use erasure_code_profile instead of properties

The prepare_pool_properties is replaced with the
prepare_erasure_code_profile method which looks up the same content from
OSDMap::erasure_code_profiles instead of the argument vector.

The type and name substitution is applied in OSDMonitor and the
MonCommand prototypes for osd pool create and osd create-erasure are
updated.

The behavior is not modified.

Signed-off-by: Loic Dachary <loic@dachary.org>
osd: use erasure code profile when building the PGBackend

The PGBackend::build_pg_backend() prototype is modified to add an
OSDMapRef which is used to get the profile stored in the pg_pool_t
and pass it to the erasure code plugin.

Signed-off-by: Loic Dachary <loic@dachary.org>
mon: add crush ruleset name to osd pool create

The ruleset to be used for the new erasure coded pool was expected in
the properties, under the name crush_ruleset. It does not belong to the
erasure code profile and needs to be added to the prototype explicitly.

The crush ruleset name is added to the prototype of the prepare_new_pool
and prepare_pool_crush_ruleset methods.

Signed-off-by: Loic Dachary <loic@dachary.org>
mon: set the profile and ruleset defaults early

The poolstr is removed from the prepare_pool_crush_ruleset prototype
because it no longer decides for the default ruleset, if it is not
omitted by the caller of osd pool create.

If no profile
  profile = default
If no ruleset and profile is default
  ruleset = erasure-code
If no ruleset and profile is not default
  ruleset = the name of the pool

Signed-off-by: Loic Dachary <loic@dachary.org>
osd: create erasure_code_profile in OSDMap::build_simple

The "default" erasure_code_profile is set by OSDMap::build_simple using
the osd_pool_default_erasure_code_profile default configuration option.

Signed-off-by: Loic Dachary <loic@dachary.org>
osd: create the erasure-code ruleset in OSDMap::build_simple

Using the "default" profile, add the matching erasure-code ruleset.

Signed-off-by: Loic Dachary <loic@dachary.org>
mon: add osd crush create-erasure functional tests

Cleanup the TEST_crush_rule_all function from redundant leftovers.
Explicitly test crush rule rm instead of implicitly.

Signed-off-by: Loic Dachary <loic@dachary.org>
osd,mon: use profile instead of properties

The qa and functional tests are adapted to the new command prototype
requiring a profile instead of a list of properties. When possible the
implicit ruleset creation is used to simplify the test setup.

Signed-off-by: Loic Dachary <loic@dachary.org>