]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-volume: adds a lvm_size property to util.Device
authorAndrew Schoen <aschoen@redhat.com>
Wed, 5 Dec 2018 15:43:28 +0000 (09:43 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Thu, 6 Dec 2018 18:29:47 +0000 (12:29 -0600)
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 <aschoen@redhat.com>
src/ceph-volume/ceph_volume/util/device.py

index fd48f10b482778c12e02d344cdbaaa70665a130b..b2ae0fd8bca8f7c4ebae86f3f1b15de06cf2e399 100644 (file)
@@ -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):