Skip to content

Commit

Permalink
Mon: When set pool crush rule should consider the pool size.
Browse files Browse the repository at this point in the history
Fixes: #14495
Signed-off-by: song baisen <song.baisen@zte.com.cn>
  • Loading branch information
songbaisen committed Jan 26, 2016
1 parent 8676120 commit a1630d6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/mon/OSDMonitor.cc
Expand Up @@ -4955,6 +4955,19 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
ss << "crush ruleset " << n << " does not exist";
return -ENOENT;
}
const int64_t ipoolsize = p.get_size();
const int64_t iminsize = osdmap.crush->get_rule_mask_min_size(n);
if (ipoolsize < iminsize) {
ss << "pool size " << ipoolsize << " is smaller than crush ruleset "
<< n << " min size " << iminsize;
return -EINVAL;
}
const int64_t imaxsize = osdmap.crush->get_rule_mask_max_size(n);
if (ipoolsize > imaxsize) {
ss << "pool size " << ipoolsize << " is bigger than crush ruleset "
<< n << " max size " << imaxsize;
return -EINVAL;
}
p.crush_ruleset = n;
} else if (var == "hashpspool" || var == "nodelete" || var == "nopgchange" ||
var == "nosizechange" || var == "write_fadvise_dontneed" ||
Expand Down

0 comments on commit a1630d6

Please sign in to comment.