int CrushWrapper::insert_item(
CephContext *cct, int item, float weight, string name,
- const map<string,string>& loc) // typename -> bucketname
+ const map<string,string>& loc, // typename -> bucketname
+ bool init_weight_sets)
{
ldout(cct, 5) << "insert_item item " << item << " weight " << weight
<< " name " << name << " loc " << loc << dendl;
}
// adjust the item's weight in location
- if (adjust_item_weightf_in_loc(cct, item, weight, loc) > 0) {
+ if (adjust_item_weightf_in_loc(cct, item, weight, loc,
+ item >= 0 && init_weight_sets) > 0) {
if (item >= crush->max_devices) {
crush->max_devices = item + 1;
ldout(cct, 5) << "insert_item max_devices now " << crush->max_devices
* @param weight item weight
* @param name item name
* @param loc location (map of type to bucket names)
+ * @param init_weight_sets initialize weight-set weights to weight (vs 0)
* @return 0 for success, negative on error
*/
- int insert_item(CephContext *cct, int id, float weight, string name, const map<string,string>& loc);
+ int insert_item(CephContext *cct, int id, float weight, string name,
+ const map<string,string>& loc,
+ bool init_weight_sets=true);
/**
* move a bucket in the hierarchy to the given location