]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: fix simple activate when legacy osd
authorGuillaume Abrioux <gabrioux@redhat.com>
Thu, 10 Sep 2020 23:13:06 +0000 (01:13 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 16 Sep 2020 15:32:50 +0000 (17:32 +0200)
`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 <gabrioux@redhat.com>
(cherry picked from commit a3e9e215bda110b3224e165bee6565943b3f3c14)

src/ceph-volume/ceph_volume/devices/simple/activate.py

index bcc9645d67bf10be81313afc3fc281a582c8a384..4ce69d019b8bb98ab2c0ba496eaaa5274a104adf 100644 (file)
@@ -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