From: Guillaume Abrioux Date: Thu, 10 Sep 2020 23:13:06 +0000 (+0200) Subject: ceph-volume: fix simple activate when legacy osd X-Git-Tag: v16.1.0~1082^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F37093%2Fhead;p=ceph.git ceph-volume: fix simple activate when legacy osd `ceph-volume simple activate --all` relies on the presence of json files in `/etc/ceph/osd` that was created with `ceph-volume simple scan` command. In a cluster lifecycle, it is very likely an OSD which was deployed with ceph-disk at some point gets removed or replaced. It means the corresponding json file in `/etc/ceph/osd` becomes unrelevant. It makes `ceph-volume simple activate --all` fails because it tries to mount non existing partitions. The idea here is to simply warn the user that the osd described in the json file doesn't exist anymore and exit properly instead of throwing an error. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1877672 Closes: https://tracker.ceph.com/issues/47493 Signed-off-by: Guillaume Abrioux --- diff --git a/src/ceph-volume/ceph_volume/devices/simple/activate.py b/src/ceph-volume/ceph_volume/devices/simple/activate.py index bcc9645d67bf..4ce69d019b8b 100644 --- a/src/ceph-volume/ceph_volume/devices/simple/activate.py +++ b/src/ceph-volume/ceph_volume/devices/simple/activate.py @@ -169,6 +169,12 @@ class Activate(object): # XXX there is no support for LVM here data_device = self.get_device(data_uuid) + + if not data_device: + raise RuntimeError("osd fsid {} doesn't exist, this file will " + "be skipped, consider cleaning legacy " + "json file {}".format(osd_metadata['fsid'], args.json_config)) + journal_device = self.get_device(osd_metadata.get('journal', {}).get('uuid')) block_device = self.get_device(osd_metadata.get('block', {}).get('uuid')) block_db_device = self.get_device(osd_metadata.get('block.db', {}).get('uuid')) @@ -277,7 +283,10 @@ class Activate(object): for json_config in json_configs: mlogger.info('activating OSD specified in {}'.format(json_config)) args.json_config = json_config - self.activate(args) + try: + self.activate(args) + except RuntimeError as e: + terminal.warning(e) else: if args.file: json_config = args.file