[master 3/6] Add a property for Requests to reserve some extra space
vpodzime
installerbot-noreply at redhat.com
Wed Aug 19 13:51:06 UTC 2015
From: Vratislav Podzimek <vpodzime at redhat.com>
This is generic concept for requests that require some extra space that
shouldn't be included in their base size because it is extra/external space
taken from the same Chunk. The only usage/case right now is for LVRequests of
cached LVs to reserve space for their caches in a nicer and cleaner way, but
more are expected to come in the future because many devices require some fixed
extra space that is not part of their real/usable size (usually some metadata
space).
---
blivet/partitioning.py | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index 29e97e9..cd42130 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -945,6 +945,13 @@ def __init__(self, device):
self.base = 0 # base sectors
@property
+ def reserveRequest(self):
+ """ Requested reserved fixed extra space for the request (in sectors) """
+
+ # generic requests don't need any such extra space
+ return 0
+
+ @property
def growable(self):
""" True if this request is growable. """
return getattr(self.device, "req_grow", True)
@@ -1014,6 +1021,14 @@ def __init__(self, lv):
# max size is less than or equal to base, so we're done
self.done = True
+ @property
+ def reserveRequest(self):
+ reserve = super(LVRequest, self).reserveRequest
+ if self.device.cached:
+ total_cache_size = self.device.cache.size + self.device.cache.md_size
+ reserve += int(self.device.vg.align(total_cache_size, roundup=True) / self.device.vg.peSize)
+
+ return reserve
class Chunk(object):
""" A free region from which devices will be allocated """
@@ -1068,6 +1083,7 @@ def addRequest(self, req):
self.requests.append(req)
self.pool -= req.base
+ self.pool -= req.reserveRequest
if not req.done:
self.base += req.base
@@ -1404,10 +1420,6 @@ def addRequest(self, req):
if max_raid_disks > 1:
self.pool -= 5 * max_raid_disks
- if req.device.cached:
- # cached LV -> reserve space for the cache
- self.pool -= int(self.vg.align(req.device.cache.size, roundup=True) / self.vg.peSize)
-
super(VGChunk, self).addRequest(req)
def lengthToSize(self, length):
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/e48828c7184136c6dc8eb2b619515404debe2e63
More information about the anaconda-patches
mailing list