Skip to content

Commit

Permalink
rados: safety interlock on 'rmpool' command
Browse files Browse the repository at this point in the history
This is a very easy way for a user to do a lot of damage with no way back.
Make sure they mean it.

Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
Sage Weil committed Jan 23, 2013
1 parent c993ac9 commit c061e84
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1776,6 +1776,16 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
else if (strcmp(nargs[0], "rmpool") == 0) {
if (nargs.size() < 2)
usage_exit();
if (nargs.size() < 4 ||
strcmp(nargs[1], nargs[2]) != 0 ||
strcmp(nargs[3], "--yes-i-really-really-mean-it") != 0) {
cerr << "WARNING:\n"
<< " This will PERMANENTLY DESTROY an entire pool of object with no way back.\n"
<< " To confirm, pass the pool to remove twice, followed by\n"
<< " --yes-i-really-really-mean-it" << std::endl;
cout << nargs << std::endl;
return 1;
}
ret = rados.pool_delete(nargs[1]);
if (ret >= 0) {
cout << "successfully deleted pool " << nargs[1] << std::endl;
Expand Down

0 comments on commit c061e84

Please sign in to comment.