From 5f6b11a6ad5c224d823712d07eb6fff861d9c60d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 16 Jul 2014 17:24:36 -0700 Subject: [PATCH] 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 --- src/mon/MDSMonitor.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 689f70a07d5..34b9632338e 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -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") {