From ab99ee91a5b0c930dd5009ec4041fe7a32825195 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Wed, 5 Dec 2018 09:43:28 -0600 Subject: [PATCH] ceph-volume: adds a lvm_size property to util.Device This will give us the size lvm should report because it takes into account the 1GB physical extent size we set. Signed-off-by: Andrew Schoen (cherry picked from commit 5197c16b44fcf344862201549777dc2935fc19a3) --- src/ceph-volume/ceph_volume/util/device.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ceph-volume/ceph_volume/util/device.py b/src/ceph-volume/ceph_volume/util/device.py index 2e99d2b7497d9..cb62a744fbf2a 100644 --- a/src/ceph-volume/ceph_volume/util/device.py +++ b/src/ceph-volume/ceph_volume/util/device.py @@ -277,7 +277,17 @@ class Device(object): @property def size(self): - return self.sys_api['size'] + return self.sys_api['size'] + + @property + def lvm_size(self): + """ + If this device was made into a PV it would lose 1GB in total size + due to the 1GB physical extent size we set when creating volume groups + """ + size = disk.Size(b=self.size) + lvm_size = disk.Size(gb=size.gb.as_int()) - disk.Size(gb=1) + return lvm_size @property def is_lvm_member(self): -- 2.39.5