]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: cleanup code
authorSatoru Takeuchi <satoru.takeuchi@gmail.com>
Fri, 22 May 2020 01:07:17 +0000 (01:07 +0000)
committerJan Fajerski <jfajerski@suse.com>
Thu, 10 Sep 2020 07:52:10 +0000 (09:52 +0200)
Simplify the logic and fix a typo.

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
(cherry picked from commit 0169b72fff48134ef01802ade38c55281b9f4510)

src/ceph-volume/ceph_volume/util/device.py

index cd6237d183c810b12edc8d1207487bd6d0a07517..2d00f6da3e59638deda4cf214da1a75151d97672 100644 (file)
@@ -398,7 +398,7 @@ class Device(object):
         ]
         rejected = [reason for (k, v, reason) in reasons if
                     self.sys_api.get(k, '') == v]
-        # reject disks small than 5GB
+        # reject disks smaller than 5GB
         if int(self.sys_api.get('size', 0)) < 5368709120:
             rejected.append('Insufficient space (<5GB)')
         if self.is_ceph_disk_member:
@@ -409,11 +409,11 @@ class Device(object):
 
     def _check_lvm_reject_reasons(self):
         rejected = []
-        available_vgs = [vg for vg in self.vgs if vg.free >= 5368709120]
-        if self.vgs and not available_vgs:
-            rejected.append('Insufficient space (<5GB) on vgs')
-
-        if not self.vgs:
+        if self.vgs:
+            available_vgs = [vg for vg in self.vgs if vg.free >= 5368709120]
+            if not available_vgs:
+                rejected.append('Insufficient space (<5GB) on vgs')
+        else:
             # only check generic if no vgs are present. Vgs might hold lvs and
             # that might cause 'locked' to trigger
             rejected.extend(self._check_generic_reject_reasons())