mirror of
https://github.com/ceph/ceph
synced 2025-02-05 18:03:54 +00:00
mon/OSDMonitor: add boundary check for pool recovery_priority
See https://github.com/ceph/ceph/pull/26705 Fixes: http://tracker.ceph.com/issues/38578 Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
parent
c5036f912a
commit
733fff22bb
@ -2012,6 +2012,8 @@ function test_mon_osd_pool_set()
|
||||
ceph osd pool get $TEST_POOL_GETSET recovery_priority | grep 'recovery_priority: 5'
|
||||
ceph osd pool set $TEST_POOL_GETSET recovery_priority 0
|
||||
ceph osd pool get $TEST_POOL_GETSET recovery_priority | expect_false grep '.'
|
||||
expect_false ceph osd pool set $TEST_POOL_GETSET recovery_priority -1
|
||||
expect_false ceph osd pool set $TEST_POOL_GETSET recovery_priority 30
|
||||
|
||||
ceph osd pool get $TEST_POOL_GETSET recovery_op_priority | expect_false grep '.'
|
||||
ceph osd pool set $TEST_POOL_GETSET recovery_op_priority 5
|
||||
|
@ -7557,6 +7557,19 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
|
||||
<< " > pg_num " << p.get_pg_num_target();
|
||||
return -EINVAL;
|
||||
}
|
||||
} else if (var == "recovery_priority") {
|
||||
if (interr.length()) {
|
||||
ss << "error parsing int value '" << val << "': " << interr;
|
||||
return -EINVAL;
|
||||
}
|
||||
if (n < 0) {
|
||||
ss << "pool recovery_priority can not be negative";
|
||||
return -EINVAL;
|
||||
} else if (n >= 30) {
|
||||
ss << "pool recovery_priority should be less than 30 due to "
|
||||
<< "Ceph internal implementation restrictions";
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
pool_opts_t::opt_desc_t desc = pool_opts_t::get_opt_desc(var);
|
||||
|
Loading…
Reference in New Issue
Block a user