]> git.apps.os.sepia.ceph.com Git - ceph.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)
committerJan Fajerski <jfajerski@suse.com>
Wed, 24 Jul 2019 13:47:29 +0000 (15:47 +0200)
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>
(cherry picked from commit 5197c16b44fcf344862201549777dc2935fc19a3)

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

index 2e99d2b7497d981819a6b11c163facb76a2f7cb0..cb62a744fbf2a677b3d0534e3c6911cae4344e02 100644 (file)
@@ -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):