mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ji...@apache.org
Subject [03/12] mesos git commit: Fixed the calculation of available capacity test CSI plugin.
Date Tue, 19 Dec 2017 23:14:33 GMT
Fixed the calculation of available capacity test CSI plugin.

The size of existing volumes should be substracted away from the
available capacity. Otherwise, the total capacity will keep increasing
every time the plugin restarts.

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


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

Branch: refs/heads/master
Commit: 69650845fa9bd88926d37fc7a2b5e40fbeb89b54
Parents: cafd388
Author: Chun-Hung Hsiao <chhsiao@mesosphere.io>
Authored: Tue Dec 19 11:25:19 2017 -0800
Committer: Jie Yu <yujie.jay@gmail.com>
Committed: Tue Dec 19 15:14:22 2017 -0800

----------------------------------------------------------------------
 src/examples/test_csi_plugin.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/69650845/src/examples/test_csi_plugin.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_csi_plugin.cpp b/src/examples/test_csi_plugin.cpp
index 742aea9..f6b2c98 100644
--- a/src/examples/test_csi_plugin.cpp
+++ b/src/examples/test_csi_plugin.cpp
@@ -79,7 +79,7 @@ public:
     add(&Flags::available_capacity,
         "available_capacity",
         "The available disk capacity managed by the plugin, in addition\n"
-        "to the pre-existing volumes.");
+        "to the pre-existing volumes specified in the --volumes flag.");
 
     add(&Flags::volumes,
         "volumes",
@@ -123,6 +123,11 @@ public:
 
       CHECK(!volumes.contains(volume->id));
       volumes.put(volume->id, volume.get());
+
+      if (!_volumes.contains(volume->id)) {
+        CHECK_GE(availableCapacity, volume->size);
+        availableCapacity -= volume->size;
+      }
     }
 
     foreachpair (const string& name, const Bytes& capacity, _volumes) {


Mime
View raw message