Project

General

Profile

Bug #19119 ยป osdmaptool.diff

Ilya Dryomov, 03/01/2017 06:45 PM

View differences:

src/tools/osdmaptool.cc
void usage()
{
cout << " usage: [--print] [--createsimple <numosd> [--clobber] [--pg_bits <bitsperosd>]] <mapfilename>" << std::endl;
cout << " usage: [--print] [--createsimple <numosd> [--clobber] [--pg_bits <bitsperosd>]] <mapfilename> [<incmapfilename>...]" << 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>] [--pg_num <pg_num>] map all pgs" << std::endl;
......
cerr << me << ": must specify osdmap filename" << std::endl;
usage();
}
else if (args.size() > 1) {
cerr << me << ": too many arguments" << std::endl;
usage();
}
fn = args[0];
if (range_first >= 0 && range_last >= 0) {
......
modified = true;
}
for (auto it = args.begin() + 1; it != args.end(); ++it) {
OSDMap::Incremental inc;
bufferlist inc_bl;
cerr << me << ": incremental file '" << *it << "'" << std::endl;
std::string error;
r = inc_bl.read_file(*it, &error);
if (r == 0) {
try {
bufferlist::iterator p = inc_bl.begin();
inc.decode(p);
} catch (const buffer::error &e) {
cerr << me << ": error decoding incremental '" << *it << "'" << std::endl;
return -1;
}
} else {
cerr << me << ": couldn't open " << *it << ": " << error << std::endl;
return -1;
}
epoch_t e = osdmap.get_epoch() + 1;
if (inc.epoch != e) {
cerr << me << ": incremental epoch mismatch: " << inc.epoch << " != " << e << std::endl;
return -1;
}
osdmap.apply_incremental(inc);
}
if (mark_up_in) {
cout << "marking all OSDs up and in" << std::endl;
int n = osdmap.get_max_osd();
    (1-1/1)