]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/ceph-volume/ceph_volume/devices/lvm/batch.py
import 15.2.2 octopus source
[ceph.git] / ceph / src / ceph-volume / ceph_volume / devices / lvm / batch.py
index 27ee5bb47e006f4bc9d5aa5252c1b21a9f4c91c1..b7a4b35b2fd20bae25dcabb6e9c2de91622465c3 100644 (file)
@@ -106,9 +106,12 @@ def filter_devices(args):
     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"),
-            )
+            if last_device.lvs:
+                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"),
+                )
+            else:
+                reason = "Disk is an LVM member already, skipping"
             filtered_devices[last_device.abspath] = {"reasons": [reason]}
             logger.info(reason + ": %s" % last_device.abspath)
             unused_devices = []
@@ -366,7 +369,12 @@ class Batch(object):
                 self.filtered_devices.update({d: used_reason for d in
                                               getattr(self.args, dev_list_prop)
                                               if d.used_by_ceph})
-                if self.args.yes and dev_list and devs != usable:
+                # only fail if non-interactive, this iteration concerns
+                # non-data devices, there are usable data devices (or not all
+                # data devices were filtered) and non-data devices were filtered
+                # so in short this branch is not taken if all data devices are
+                # filtered
+                if self.args.yes and dev_list and self.usable and devs != usable:
                     err = '{} devices were filtered in non-interactive mode, bailing out'
                     raise RuntimeError(err.format(len(devs) - len(usable)))