usage: [--print] [--createsimple <numosd> [--clobber] [--pg_bits <bitsperosd>]] <mapfilename>
--export-crush <file> write osdmap's crush map to <file>
--import-crush <file> replace osdmap's crush map with <file>
- --test-map-pgs [--pool <poolid>] map all pgs
+ --test-map-pgs [--pool <poolid>] [--pg_num <pg_num>] map all pgs
--test-map-pgs-dump [--pool <poolid>] map all pgs
--mark-up-in mark osds up and in (but do not persist)
--clear-temp clear pg_temp and primary_temp
usage: [--print] [--createsimple <numosd> [--clobber] [--pg_bits <bitsperosd>]] <mapfilename>
--export-crush <file> write osdmap's crush map to <file>
--import-crush <file> replace osdmap's crush map with <file>
- --test-map-pgs [--pool <poolid>] map all pgs
+ --test-map-pgs [--pool <poolid>] [--pg_num <pg_num>] map all pgs
--test-map-pgs-dump [--pool <poolid>] map all pgs
--mark-up-in mark osds up and in (but do not persist)
--clear-temp clear pg_temp and primary_temp
cout << " usage: [--print] [--createsimple <numosd> [--clobber] [--pg_bits <bitsperosd>]] <mapfilename>" << std::endl;
cout << " --export-crush <file> write osdmap's crush map to <file>" << std::endl;
cout << " --import-crush <file> replace osdmap's crush map with <file>" << std::endl;
- cout << " --test-map-pgs [--pool <poolid>] map all pgs" << std::endl;
+ cout << " --test-map-pgs [--pool <poolid>] [--pg_num <pg_num>] map all pgs" << std::endl;
cout << " --test-map-pgs-dump [--pool <poolid>] map all pgs" << std::endl;
cout << " --mark-up-in mark osds up and in (but do not persist)" << std::endl;
cout << " --clear-temp clear pg_temp and primary_temp" << std::endl;
bool test_map_pgs = false;
bool test_map_pgs_dump = false;
bool test_random = false;
+ int64_t pg_num = -1;
std::string val;
std::ostringstream err;
test_map_object = val;
} else if (ceph_argparse_flag(args, i, "--test_crush", (char*)NULL)) {
test_crush = true;
+ } else if (ceph_argparse_witharg(args, i, &val, err, "--pg_num", (char*)NULL)) {
+ string interr;
+ pg_num = strict_strtoll(val.c_str(), 10, &interr);
+ if (interr.length() > 0)
+ cerr << "error parsing integer value " << interr << std::endl;
} else if (ceph_argparse_witharg(args, i, &range_first, err, "--range_first", (char*)NULL)) {
} else if (ceph_argparse_witharg(args, i, &range_last, err, "--range_last", (char*)NULL)) {
} else if (ceph_argparse_witharg(args, i, &pool, err, "--pool", (char*)NULL)) {
vector<int> size(30, 0);
if (test_random)
srand(getpid());
- const map<int64_t,pg_pool_t>& pools = osdmap.get_pools();
- for (map<int64_t,pg_pool_t>::const_iterator p = pools.begin();
+ map<int64_t,pg_pool_t>& pools = osdmap.get_pools();
+ for (map<int64_t,pg_pool_t>::iterator p = pools.begin();
p != pools.end(); ++p) {
if (pool != -1 && p->first != pool)
continue;
+ if (pg_num > 0)
+ p->second.set_pg_num(pg_num);
+
cout << "pool " << p->first
<< " pg_num " << p->second.get_pg_num() << std::endl;
for (unsigned i = 0; i < p->second.get_pg_num(); ++i) {