]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: filter devices used by journals/block.db
authorAndrew Schoen <aschoen@redhat.com>
Mon, 8 Oct 2018 13:57:07 +0000 (09:57 -0400)
committerAndrew Schoen <aschoen@redhat.com>
Wed, 10 Oct 2018 19:30:29 +0000 (15:30 -0400)
If after filterering of data/block devices there are only
one device left it can not be used if it is an SSD and
has been used previously as a journal or block.db

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
src/ceph-volume/ceph_volume/devices/lvm/batch.py

index e85ab9d1456cdc1c3de4abd66ccc395c0ebac632..0565526afe1cefe919dd8b111534cdc47a137bc5 100644 (file)
@@ -1,4 +1,5 @@
 import argparse
+import logging
 from textwrap import dedent
 from ceph_volume import terminal, decorators
 from ceph_volume.util import disk, prompt_bool
@@ -6,6 +7,7 @@ from ceph_volume.util import arg_validators
 from . import strategies
 
 mlogger = terminal.MultiLogger(__name__)
+logger = logging.getLogger(__name__)
 
 
 device_list_template = """
@@ -159,8 +161,16 @@ class Batch(object):
         if used_devices:
             for device in used_devices:
                 args.filtered_devices[device] = {"reasons": ["Used by ceph as a data device already"]}
-            if args.yes and unused_devices:
-                mlogger.info("Ignoring devices already used by ceph: %s" % ", ".join(used_devices))
+            logger.info("Ignoring devices already used by ceph: %s" % ", ".join(used_devices))
+        if len(unused_devices) == 1:
+            last_device = unused_devices[0]
+            if not last_device.rotational and last_device.is_lvm_member:
+                reason = "Used by ceph as a %s already and there are no devices left for data/block" % (
+                    last_device.lvs[0].tags.get("ceph.type"),
+                )
+                args.filtered_devices[last_device.abspath] = {"reasons": [reason]}
+                logger.info(reason + ": %s" % last_device.abspath)
+                unused_devices = []
         if not unused_devices and not args.format == 'json':
             # report nothing changed
             mlogger.info("All devices are already used by ceph. No OSDs will be created.")
@@ -168,8 +178,6 @@ class Batch(object):
         else:
             new_strategy = get_strategy(args, unused_devices)
             if new_strategy and strategy != new_strategy:
-                if args.report:
-                    mlogger.info("Ignoring devices already used by ceph: %s" % ",".join(used_devices))
                 mlogger.error("Aborting because strategy changed from %s to %s after filtering" % (strategy.type(), new_strategy.type()))
                 raise SystemExit(1)