From 57012e8d8c032356adc7c2401cbed94af962f6bb Mon Sep 17 00:00:00 2001 From: Ivo Verberk Date: Thu, 25 Aug 2016 20:48:19 +0200 Subject: [PATCH 1/2] Monitor the complete alloc directory, not just the shared part. --- client/alloc_runner_test.go | 2 +- client/allocdir/alloc_dir.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/alloc_runner_test.go b/client/alloc_runner_test.go index 2ac31517c..97abdb963 100644 --- a/client/alloc_runner_test.go +++ b/client/alloc_runner_test.go @@ -175,7 +175,7 @@ func TestAllocRunner_DiskExceeded_Destroy(t *testing.T) { // Create a 20mb file in the shared alloc directory, which should cause the // allocation to terminate in a failed state. - name := ar.ctx.AllocDir.SharedDir + "/20mb.bin" + name := ar.ctx.AllocDir.AllocDir + "/20mb.bin" f, err := os.Create(name) if err != nil { t.Fatal("unable to create file: %v", err) diff --git a/client/allocdir/alloc_dir.go b/client/allocdir/alloc_dir.go index 588f70799..43fcd416f 100644 --- a/client/allocdir/alloc_dir.go +++ b/client/allocdir/alloc_dir.go @@ -514,11 +514,11 @@ func (d *AllocDir) StopDiskWatcher() { } } -// syncDiskUsage walks the shared allocation directory recursively and +// syncDiskUsage walks the allocation directory recursively and // calculates the total consumed disk space. func (d *AllocDir) syncDiskUsage() error { var size int64 - err := filepath.Walk(d.SharedDir, + err := filepath.Walk(d.AllocDir, func(path string, info os.FileInfo, err error) error { // Ignore paths that do not have a valid FileInfo object if err == nil { From d89dc40fe20165b019b136d79af65d55e123981d Mon Sep 17 00:00:00 2001 From: Ivo Verberk Date: Thu, 25 Aug 2016 20:50:11 +0200 Subject: [PATCH 2/2] Small comment fix. --- client/alloc_runner_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/alloc_runner_test.go b/client/alloc_runner_test.go index 97abdb963..fb18a132b 100644 --- a/client/alloc_runner_test.go +++ b/client/alloc_runner_test.go @@ -173,7 +173,7 @@ func TestAllocRunner_DiskExceeded_Destroy(t *testing.T) { t.Fatalf("err: %v", err) }) - // Create a 20mb file in the shared alloc directory, which should cause the + // Create a 20mb file in the alloc directory, which should cause the // allocation to terminate in a failed state. name := ar.ctx.AllocDir.AllocDir + "/20mb.bin" f, err := os.Create(name)