From: Jan Fajerski Date: Mon, 27 Apr 2020 09:44:56 +0000 (+0200) Subject: ceph-volume: util.device - add vg_free_percent property X-Git-Tag: v14.2.13~5^2~30 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c3376b28e070ddcc3651ae48e2080416e6615f52;p=ceph.git ceph-volume: util.device - add vg_free_percent property Signed-off-by: Jan Fajerski (cherry picked from commit f48d225454e3ec347952d85262aa03b71bfb9111) --- diff --git a/src/ceph-volume/ceph_volume/util/device.py b/src/ceph-volume/ceph_volume/util/device.py index 8ea83c30e711a..0e6a920d23288 100644 --- a/src/ceph-volume/ceph_volume/util/device.py +++ b/src/ceph-volume/ceph_volume/util/device.py @@ -400,6 +400,12 @@ class Device(object): if lv.tags.get("ceph.type") in ["data", "block"]] return any(osd_ids) + @property + def vg_free_percent(self): + if self.vgs: + return [vg.vg_free_count / vg.vg_extent_count for vg in self.vgs] + else: + return [1] def _check_generic_reject_reasons(self): reasons = [