diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-03-01 08:54:27 +0000 |
---|---|---|
committer | Angelos Evripiotis <angelos.evripiotis@gmail.com> | 2019-03-01 11:01:53 +0000 |
commit | 8e954c935a668342a439f4c4808fb1425d112bb5 (patch) | |
tree | c080c8ee8f3099b4da4280081c276b5a6bebe0fc | |
parent | 57a314d8793b64859598c2217208e2d1d83af5b5 (diff) | |
download | buildstream-aevri/nonecach2.tar.gz |
cascache: limit 'infinite' cache to volume sizeaevri/nonecach2
Make sure we don't exceed the size of the volume when calculating an
'unlimited' quota.
Note that at present, cache_size is an estimate that will be the same
as the cache_size or larger. In my own case, I have a volume dedicated
to the cache, so it was easy for the cache_quota to exceed this. This
prevented me from running BuildStream, although I had plenty of free
space.
-rw-r--r-- | buildstream/_cas/cascache.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/buildstream/_cas/cascache.py b/buildstream/_cas/cascache.py index ffc9c2b93..802fc13fd 100644 --- a/buildstream/_cas/cascache.py +++ b/buildstream/_cas/cascache.py @@ -1226,8 +1226,9 @@ class CASQuota: # Also check that cache_quota is at least as large as our headroom. # cache_quota = self._config_cache_quota - if cache_quota is None: # Infinity, set to max system storage - cache_quota = cache_size + available_space + if cache_quota is None: + # The user has set no limit, so we may take all the space. + cache_quota = min(cache_size + available_space, total_size) if cache_quota < self._cache_quota_headroom: # Check minimum raise LoadError( LoadErrorReason.INVALID_DATA, |