Repository: mesos
Updated Branches:
  refs/heads/master 187dc509d -> a4f4eff1f


Update slave to use 50% of the disk space for machines with
fewer than 10GB of disk space.

Review: https://reviews.apache.org/r/19427


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a4f4eff1
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a4f4eff1
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a4f4eff1

Branch: refs/heads/master
Commit: a4f4eff1fd4744987356ef95e69592430668c0aa
Parents: 187dc50
Author: ASHUTOSH JAIN <[email protected]>
Authored: Thu Mar 20 23:43:52 2014 -0700
Committer: Benjamin Mahler <[email protected]>
Committed: Thu Mar 20 23:43:52 2014 -0700

----------------------------------------------------------------------
 src/slave/containerizer/containerizer.cpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a4f4eff1/src/slave/containerizer/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/containerizer.cpp 
b/src/slave/containerizer/containerizer.cpp
index 6de091e..344872a 100644
--- a/src/slave/containerizer/containerizer.cpp
+++ b/src/slave/containerizer/containerizer.cpp
@@ -128,12 +128,11 @@ Try<Resources> Containerizer::resources(const Flags& 
flags)
                    << "' ; defaulting to " << DEFAULT_DISK;
       disk = DEFAULT_DISK;
     } else {
-      disk = disk_.get();
-      // Leave 5 GB free if we have more than 10 GB, otherwise, use all!
-      // TODO(benh): Have better default scheme (e.g., % of disk not
-      // greater than 10 GB?)
-      if (disk > Gigabytes(10)) {
-        disk = disk - Gigabytes(5);
+      Bytes total = disk_.get();
+      if (total >= Gigabytes(10)) {
+        disk = total - Gigabytes(5); // Leave 5GB free.
+      } else {
+        disk = Bytes(total.bytes() / 2); // Use 50% of the disk.
       }
     }
 

Reply via email to