diff options
author | Mike Fulbright <msf@redhat.com> | 2002-06-10 23:07:58 +0000 |
---|---|---|
committer | Mike Fulbright <msf@redhat.com> | 2002-06-10 23:07:58 +0000 |
commit | 9c3b3400fa9782fc8850ef021b8a6b232c21157d (patch) | |
tree | 96ef09f306f7377e15060fea81ef7e29043fe430 /lvm.py | |
parent | 761af7c1e2b10632ff4af436b25eb19bd4dd53d4 (diff) | |
download | anaconda-9c3b3400fa9782fc8850ef021b8a6b232c21157d.tar.gz anaconda-9c3b3400fa9782fc8850ef021b8a6b232c21157d.tar.xz anaconda-9c3b3400fa9782fc8850ef021b8a6b232c21157d.zip |
helper functions for getting extents possible values and clamping LV sizes to a PE value
Diffstat (limited to 'lvm.py')
-rw-r--r-- | lvm.py | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -101,3 +101,31 @@ def vgremove(vgname): searchPath = 1) if rc: raise SystemError, "vgremove failed" + +def getPossiblePhysicalExtents(floor=0): + """Returns a list of integers representing the possible values for + the physical extent of a volume group. Value is in KB. + + floor - size (in KB) of smallest PE we care about. + """ + + possiblePE = [] + curpe = 8 + while curpe <= 16384*1024: + if curpe >= floor: + possiblePE.append(curpe) + curpe = curpe * 2 + + return possiblePE + +def clampLVSizeRequest(size, pe): + """Given a size and a PE, returns the actual size of logical volumne. + + size - size (in MB) of logical volume request + pe - PE size (in KB) + """ + + if ((size*1024L) % pe) == 0: + return size + else: + return ((long((size*1024L)/pe)+1L)*pe)/1024 |