]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/volumes: move up 'confirm' validation
authorJoshua Schmid <jschmid@suse.de>
Wed, 20 Nov 2019 13:58:47 +0000 (14:58 +0100)
committerJoshua Schmid <jschmid@suse.de>
Thu, 21 Nov 2019 15:55:10 +0000 (16:55 +0100)
Instead of checking if the --yes-i-really-mean-it
flag was set _after_ removing the MDS daemon, we
need to check if before starting any removal operation.

Fixes: https://tracker.ceph.com/issues/42931
Signed-off-by: Joshua Schmid <jschmid@suse.de>
src/pybind/mgr/volumes/fs/volume.py

index b0cd35f2fd5c3f2203aa8c09e9a1c997ca63b70a..42ee42a4b40b4eb575fc75fbc4c63765018e7ce3 100644 (file)
@@ -257,13 +257,7 @@ class VolumeClient(object):
                    'data': data_pool}
         return self.mgr.mon_command(command)
 
-    def remove_filesystem(self, fs_name, confirm):
-        if confirm != "--yes-i-really-mean-it":
-            return -errno.EPERM, "", "WARNING: this will *PERMANENTLY DESTROY* all data " \
-                "stored in the filesystem '{0}'. If you are *ABSOLUTELY CERTAIN* " \
-                "that is what you want, re-issue the command followed by " \
-                "--yes-i-really-mean-it.".format(fs_name)
-
+    def remove_filesystem(self, fs_name):
         command = {'prefix': 'fs fail', 'fs_name': fs_name}
         r, outb, outs = self.mgr.mon_command(command)
         if r != 0:
@@ -319,6 +313,12 @@ class VolumeClient(object):
         if self.stopping.isSet():
             return -errno.ESHUTDOWN, "", "shutdown in progress"
 
+        if confirm != "--yes-i-really-mean-it":
+            return -errno.EPERM, "", "WARNING: this will *PERMANENTLY DESTROY* all data " \
+                "stored in the filesystem '{0}'. If you are *ABSOLUTELY CERTAIN* " \
+                "that is what you want, re-issue the command followed by " \
+                "--yes-i-really-mean-it.".format(volname)
+
         self.purge_queue.cancel_purge_job(volname)
         self.connection_pool.del_fs_handle(volname, wait=True)
         # Tear down MDS daemons
@@ -337,7 +337,7 @@ class VolumeClient(object):
         # In case orchestrator didn't tear down MDS daemons cleanly, or
         # there was no orchestrator, we force the daemons down.
         if self.volume_exists(volname):
-            r, outb, outs = self.remove_filesystem(volname, confirm)
+            r, outb, outs = self.remove_filesystem(volname)
             if r != 0:
                 return r, outb, outs
         else: