lib/config, lib/model: Use path from locations to check disk space for db (#5525)

This commit is contained in:
Simon Frei
2019-02-12 13:25:11 +01:00
committed by Audrius Butkevicius
parent d85ef949be
commit 4299af1c63
4 changed files with 8 additions and 19 deletions

View File

@@ -21,6 +21,7 @@ import (
"github.com/syncthing/syncthing/lib/events"
"github.com/syncthing/syncthing/lib/fs"
"github.com/syncthing/syncthing/lib/ignore"
"github.com/syncthing/syncthing/lib/locations"
"github.com/syncthing/syncthing/lib/osutil"
"github.com/syncthing/syncthing/lib/protocol"
"github.com/syncthing/syncthing/lib/scanner"
@@ -269,8 +270,11 @@ func (f *folder) getHealthError() error {
return err
}
if err := f.model.cfg.CheckHomeFreeSpace(); err != nil {
return err
dbPath := locations.Get(locations.Database)
if usage, err := fs.NewFilesystem(fs.FilesystemTypeBasic, dbPath).Usage("."); err == nil {
if err = config.CheckFreeSpace(f.model.cfg.Options().MinHomeDiskFree, usage); err != nil {
return fmt.Errorf("insufficient space on disk for database (%v): %v", dbPath, err)
}
}
return nil