int CrushWrapper::create_or_move_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)
{
int ret = 0;
int old_iweight;
ldout(cct, 5) << "create_or_move_item adding " << item
<< " weight " << weight
<< " at " << loc << dendl;
- ret = insert_item(cct, item, weight, name, loc);
+ ret = insert_item(cct, item, weight, name, loc,
+ item >= 0 && init_weight_sets);
if (ret == 0)
ret = 1; // changed
}
* @param weight initial item weight (if we need to create it)
* @param name item name
* @param loc location (map of type to bucket names)
+ * @param init_weight_sets initialize weight-set values to weight (vs 0)
* @return 0 for no change, 1 for successful change, negative on error
*/
int create_or_move_item(CephContext *cct, int item, float weight, string name,
- const map<string,string>& loc);
+ const map<string,string>& loc,
+ bool init_weight_sets=true);
/**
* remove all instances of an item from the map