Skip to content

Commit

Permalink
Reduce free disk space requirement to 250Mib
Browse files Browse the repository at this point in the history
  • Loading branch information
wallyworld committed Dec 11, 2015
1 parent 458fff3 commit 6312a0c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions upgrades/preupgradesteps.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ func PreUpgradeSteps(st *state.State, agentConf agent.Config, isMaster bool) err
return nil
}

// We'll be conservative and require at least 2GiB of disk space for an upgrade.
var MinDiskSpaceGib = uint64(2)
// We'll be conservative and require at least 250MiB of disk space for an upgrade.
var MinDiskSpaceMib = uint64(250)

func checkDiskSpace(dir string) error {
usage := du.NewDiskUsage(dir)
free := usage.Free()
if free < uint64(MinDiskSpaceGib*humanize.GiByte) {
return errors.Errorf("not enough free disk space for upgrade: %s available, require %dGiB",
humanize.IBytes(free), MinDiskSpaceGib)
if free < uint64(MinDiskSpaceMib*humanize.MiByte) {
return errors.Errorf("not enough free disk space for upgrade: %s available, require %dMiB",
humanize.IBytes(free), MinDiskSpaceMib)
}
return nil
}
2 changes: 1 addition & 1 deletion upgrades/preupgradesteps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var _ = gc.Suite(&preupgradechecksSuite{})

func (s *preupgradechecksSuite) TestCheckFreeDiskSpace(c *gc.C) {
// Expect an impossibly large amount of free disk.
s.PatchValue(&upgrades.MinDiskSpaceGib, uint64(humanize.EiByte/humanize.GiByte))
s.PatchValue(&upgrades.MinDiskSpaceMib, uint64(humanize.PiByte/humanize.MiByte))
err := upgrades.PreUpgradeSteps(nil, &mockAgentConfig{dataDir: "/"}, false)
c.Assert(err, gc.ErrorMatches, "not enough free disk space for upgrade: .*")
}

0 comments on commit 6312a0c

Please sign in to comment.