From: Andrew Schoen Date: Wed, 5 Dec 2018 15:43:28 +0000 (-0600) Subject: ceph-volume: adds a lvm_size property to util.Device X-Git-Tag: v14.1.0~668^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5197c16b44fcf344862201549777dc2935fc19a3;p=ceph-ci.git 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 --- diff --git a/src/ceph-volume/ceph_volume/util/device.py b/src/ceph-volume/ceph_volume/util/device.py index fd48f10b482..b2ae0fd8bca 100644 --- a/src/ceph-volume/ceph_volume/util/device.py +++ b/src/ceph-volume/ceph_volume/util/device.py @@ -259,7 +259,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):