]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephadm: bail out early during adopt if data dir not present
authorTim Serong <tserong@suse.com>
Thu, 16 Apr 2020 05:42:08 +0000 (15:42 +1000)
committerTim Serong <tserong@suse.com>
Thu, 16 Apr 2020 05:42:12 +0000 (15:42 +1000)
In case someone tries to run this again on an already adopted daemon...

Signed-off-by: Tim Serong <tserong@suse.com>
src/cephadm/cephadm

index b43c3b2d2384cd23d5544232a01969858268ef68..9fed6fdd190b307cf78ef2b8a78668bbad65a3af 100755 (executable)
@@ -3177,6 +3177,11 @@ def command_adopt_ceph(daemon_type, daemon_id, fsid):
                     (daemon_type, args.cluster, daemon_id))
     data_dir_src = os.path.abspath(args.legacy_dir + data_dir_src)
 
+    if not os.path.exists(data_dir_src):
+        raise Error("{}.{} data directory '{}' does not exist.  "
+                    "Incorrect ID specified, or daemon alrady adopted?".format(
+                    daemon_type, daemon_id, data_dir_src))
+
     osd_fsid = None
     if daemon_type == 'osd':
         adopt_osd = AdoptOsd(data_dir_src, daemon_id)