mon/MDSMonitor: make legacy 'newfs' command idempotent

We need to return success if we get a dup command.  Simply check whether
the fs is already enabled with the same pools and name.

Fixes: #8857
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2014-07-16 17:24:36 -07:00
parent bf252c8df9
commit 5f6b11a6ad

View File

@ -955,6 +955,16 @@ bool MDSMonitor::management_command(
return true;
}
// be idempotent.. success if it already exists and matches
if (mdsmap.get_enabled() &&
mdsmap.get_metadata_pool() == metadata &&
mdsmap.get_first_data_pool() == data &&
mdsmap.fs_name == MDS_FS_NAME_DEFAULT) {
ss << "filesystem '" << MDS_FS_NAME_DEFAULT << "' already exists";
r = 0;
return true;
}
string sure;
cmd_getval(g_ceph_context, cmdmap, "sure", sure);
if (pending_mdsmap.get_enabled() && sure != "--yes-i-really-mean-it") {