Otherwise it will finally crash the mgr process:
```
-2> 2018-09-11 16:23:31.272
7ff521d59700 -1 /clove/xxG/ceph/src/osd/osd_types.cc: In function 'pg_t pg_t::get_parent() const'
thread
7ff521d59700 time 2018-09-11 16:23:31.272096
/clove/xxG/ceph/src/osd/osd_types.cc: 587: FAILED ceph_assert(bits)
```
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
ceph osd pool set $TEST_POOL_GETSET pg_num 10
wait_for_clean
ceph osd pool set $TEST_POOL_GETSET pgp_num 10
+ expect_false ceph osd pool set $TEST_POOL_GETSET pg_num 0
+ expect_false ceph osd pool set $TEST_POOL_GETSET pgp_num 0
old_pgs=$(ceph osd pool get $TEST_POOL_GETSET pg_num | sed -e 's/pg_num: //')
new_pgs=$(($old_pgs + $(ceph osd stat --format json | jq '.num_osds') * 32))
if (n == (int)p.get_pg_num_target()) {
return 0;
}
- if (static_cast<uint64_t>(n) > g_conf().get_val<uint64_t>("mon_max_pool_pg_num")) {
+ if (n <= 0 || static_cast<uint64_t>(n) >
+ g_conf().get_val<uint64_t>("mon_max_pool_pg_num")) {
ss << "'pg_num' must be greater than 0 and less than or equal to "
<< g_conf().get_val<uint64_t>("mon_max_pool_pg_num")
<< " (you may adjust 'mon max pool pg num' for higher values)";