Crush: Ensuring at most num-rep osds are selected

Crush temporary buffers are allocated as per replica size configured
by the user.When there are more final osds (to be selected as per
rule) than the replicas, buffer overlaps and it causes crash.Now, it
ensures that at most num-rep osds are selected even if more number of
osds are allowed by indep rule. The fix for firstn rules is already
merged as part of bug #9492. Required test files are added.

Fixes: #9492

Signed-off-by: Johnu George johnugeo@cisco.com
Merge pull request #2599 from johnugeorge/wip-9492-crush-indep

Crush: Ensuring at most num-rep osds are selected for indep rules

Reviewed-by: Loic Dachary <loic-201408@dachary.org>