diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-03-01 08:54:27 +0000 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-03-01 14:46:51 +0000 |
commit | 3b277df80cb0543256f0514bbc1994a29688e059 (patch) | |
tree | 6767eb2f6f2e2440a2fb61d0bd848333d628e69a | |
parent | 7a407926fce8a289e2fc1cbecba92bb7a83d5970 (diff) | |
download | buildstream-3b277df80cb0543256f0514bbc1994a29688e059.tar.gz |
cascache: limit 'infinite' cache to volume size
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, |