]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/FSCommands: restore idempotent behavior of fs rm
authorPatrick Donnelly <pdonnell@redhat.com>
Fri, 8 Jan 2021 20:10:28 +0000 (12:10 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Tue, 12 Jan 2021 15:24:29 +0000 (07:24 -0800)
Fixes: https://tracker.ceph.com/issues/48808
Fixes: 811e48d6ffd841ecd93a57eb00c6aceae476f4f8
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mon/FSCommands.cc

index 058148a95fa5fedda03c0947efa177a62cf816a0..a401cc786588c7d512848546cfab6f852bda4b0c 100644 (file)
@@ -1355,8 +1355,11 @@ int FileSystemCommandHandler::is_op_allowed(
 
     auto fs = fsmap_copy.get_filesystem(fs_name);
     if (fs == nullptr) {
-      ss << "Filesystem not found: '" << fs_name << "'";
-      return -ENOENT;
+      /* let "fs rm" handle idempotent case where file system does not exist */
+      if (!(get_prefix() == "fs rm" && fsmap.get_filesystem(fs_name) == nullptr)) {
+        ss << "Filesystem not found: '" << fs_name << "'";
+        return -ENOENT;
+      }
     }
 
     if (!op->get_session()->fs_name_capable(fs_name, MON_CAP_W)) {