From: Tim Serong Date: Thu, 16 Apr 2020 05:42:08 +0000 (+1000) Subject: cephadm: bail out early during adopt if data dir not present X-Git-Tag: wip-pdonnell-testing-20200918.022351~1481^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=bed711d3d1256758bdf7428339316bcca6f9dae0;p=ceph-ci.git 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 --- 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)