gui, lib/config, lib/model: Allow absolute values for minimum disk free space (fixes #3307)

This deprecates the current minDiskFreePct setting and introduces
minDiskFree. The latter is, in it's serialized form, a string with a
unit. We accept percentages ("2.35%") and absolute values ("250 k", "12.5
Gi"). Common suffixes are understood. The config editor lets the user
enter the string, and validates it.

We still default to "1 %", but the user can change that to an absolute
value at will.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4087
LGTM: AudriusButkevicius, imsodin
This commit is contained in:
Jakob Borg
2017-04-12 09:01:19 +00:00
committed by Simon Frei
parent c205fdd77e
commit da34f27546
14 changed files with 249 additions and 40 deletions

View File

@@ -55,7 +55,7 @@ func TestDefaultValues(t *testing.T) {
CacheIgnoredFiles: false,
ProgressUpdateIntervalS: 5,
LimitBandwidthInLan: false,
MinHomeDiskFreePct: 1,
MinHomeDiskFree: Size{1, "%"},
URURL: "https://data.syncthing.net/newdata",
URInitialDelayS: 1800,
URPostInsecurely: false,
@@ -110,7 +110,7 @@ func TestDeviceConfig(t *testing.T) {
Pullers: 0,
Hashers: 0,
AutoNormalize: true,
MinDiskFreePct: 1,
MinDiskFree: Size{1, "%"},
MaxConflicts: -1,
Fsync: true,
Versioning: VersioningConfiguration{
@@ -201,7 +201,7 @@ func TestOverriddenValues(t *testing.T) {
CacheIgnoredFiles: true,
ProgressUpdateIntervalS: 10,
LimitBandwidthInLan: true,
MinHomeDiskFreePct: 5.2,
MinHomeDiskFree: Size{5.2, "%"},
URURL: "https://localhost/newdata",
URInitialDelayS: 800,
URPostInsecurely: true,