From bed711d3d1256758bdf7428339316bcca6f9dae0 Mon Sep 17 00:00:00 2001 From: Tim Serong Date: Thu, 16 Apr 2020 15:42:08 +1000 Subject: [PATCH] cephadm: bail out early during adopt if data dir not present In case someone tries to run this again on an already adopted daemon... Signed-off-by: Tim Serong --- src/cephadm/cephadm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index b43c3b2d238..9fed6fdd190 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -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) -- 2.39.5