Skip to content

Commit

Permalink
set erase-code-profile to "" when create replicated pools.
Browse files Browse the repository at this point in the history
when we create a pool specify a rule, for example "ceph osd pool create foo replicated 10 rule_foo",
we will set pool foo erase-code-profile to rule_foo,
if there has an erase-code-profile names rule_foo, use "ceph osd erase-code-profile rule_foo" will fail,
"Error EBUSY: foo pool(s) are using the erasure code profile 'rule_foo'", this is wrong.

we should do:
1. set erase-code-profile to "" when create replicated pools
2. whether erase-code-profile is used by pool not only judge pool erasure_code_profile property and also the pool is_erasure

Signed-off-by: zouaiguo <zou.aiguo@zte.com.cn>
  • Loading branch information
zouaiguo committed Dec 25, 2017
1 parent f9eea16 commit c48e2a0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mon/OSDMonitor.cc
Expand Up @@ -5442,7 +5442,7 @@ bool OSDMonitor::erasure_code_profile_in_use(
for (map<int64_t, pg_pool_t>::const_iterator p = pools.begin();
p != pools.end();
++p) {
if (p->second.erasure_code_profile == profile) {
if (p->second.erasure_code_profile == profile && p->second.is_erasure()) {
*ss << osdmap.pool_name[p->first] << " ";
found = true;
}
Expand Down Expand Up @@ -10194,6 +10194,7 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
} else {
//NOTE:for replicated pool,cmd_map will put rule_name to erasure_code_profile field
rule_name = erasure_code_profile;
erasure_code_profile = "";
}

if (!implicit_rule_creation && rule_name != "") {
Expand Down

0 comments on commit c48e2a0

Please sign in to comment.