Move the check for clones into a helper so that we will be able to use in
other places where we need to evict.
Signed-off-by: Sage Weil <sage@inktank.com>
Add a callback hook for whenever an OpContext completes or cancels. We
are pretty sloppy here about the return values because our initial user
will not care, and it is unclear if future users will.
Signed-off-by: Sage Weil <sage@inktank.com>
A PG is not always an equally sized fraction of the total pool size due to
the use of ceph_stable_mod. Add a helper to return the fraction
(denominator) of a given pg based on the current pg_num value.
Signed-off-by: Sage Weil <sage@inktank.com>
comment out erasure pool related tests when an OSD is involved because
it does not work yet. See http://tracker.ceph.com/issues/7360.
Signed-off-by: Loic Dachary <loic@dachary.org>
By default, disallow adjustment of primary affinity unless the user has
opted in by adjusting their monitor config. This will avoid some user
pain because inadvertantly setting the affinity will prevent older clients
from connecting to and using the cluster.
Signed-off-by: Sage Weil <sage@inktank.com>
The behavior is a bit different for replicated and indep/erasure mode.
In the first case, we are rearranging the result. In the second case,
we can just set the primary argument to the right value.
Signed-off-by: Sage Weil <sage@inktank.com>
--test-map-pgs mode allows to map all pgs from either all pools or just
one pool. Mention it in usage output.
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Commit 7f1b12f2ef ("osdmaptool: add --test-map-pgs mode") broke
--pool for --test-map-object mode. Fix it, and improve --pool option
handling for both modes while at it (report strict_strtol() errors,
check if specified pool exists).
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Irritatingly, using 0 binds to int and generates warnings
if the thing we're checking is unsigned, so we have to be
explicit.
Signed-off-by: Greg Farnum <greg@inktank.com>
Reviewed-by: Sam Just <sam.just@inktank.com>
If the crush ruleset is found in pending, do not goto reply because it
does not exist yet. Wait for the pending proposal (and the ruleset) to
be accepted and then only return that it exists.
revert 4b687ba673
Signed-off-by: Loic Dachary <loic@dachary.org>
Basic tests and a test that create the conditions where an OSDMap
is pending with a ruleset that is not yet in the OSDMap. An attempt to
create a rule by the same name will return success and not create it again.
Signed-off-by: Loic Dachary <loic@dachary.org>
The crush rule name is made an optional first argument. If not provided, it
defaults to dumping all rules.
Signed-off-by: Loic Dachary <loic@dachary.org>
And it is consistent with the above. Also use a slightly different
string to allow the caller to differentiate between the two cases.
Signed-off-by: Loic Dachary <loic@dachary.org>