You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2017/12/15 17:27:03 UTC

[3/4] mesos git commit: Fixed unit error in storage local resource provider.

Fixed unit error in storage local resource provider.

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


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

Branch: refs/heads/master
Commit: 1b4f3864591f526646beb32339cc48d91853c9ae
Parents: 8873870
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
Authored: Fri Dec 15 09:05:39 2017 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Fri Dec 15 09:26:55 2017 -0800

----------------------------------------------------------------------
 src/resource_provider/storage/provider.cpp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1b4f3864/src/resource_provider/storage/provider.cpp
----------------------------------------------------------------------
diff --git a/src/resource_provider/storage/provider.cpp b/src/resource_provider/storage/provider.cpp
index 5e7cb5e..12962d0 100644
--- a/src/resource_provider/storage/provider.cpp
+++ b/src/resource_provider/storage/provider.cpp
@@ -241,7 +241,7 @@ static inline http::Headers getAuthHeader(const Option<string>& authToken)
 
 static inline Resource createRawDiskResource(
     const ResourceProviderInfo& info,
-    double capacity,
+    const Bytes& capacity,
     const Option<string>& profile,
     const Option<string>& id = None(),
     const Option<Labels>& metadata = None())
@@ -251,7 +251,7 @@ static inline Resource createRawDiskResource(
   Resource resource;
   resource.set_name("disk");
   resource.set_type(Value::SCALAR);
-  resource.mutable_scalar()->set_value(capacity);
+  resource.mutable_scalar()->set_value(capacity.megabytes());
   resource.mutable_provider_id()->CopyFrom(info.id()),
   resource.mutable_reservations()->CopyFrom(info.default_reservations());
   resource.mutable_disk()->mutable_source()
@@ -1032,7 +1032,7 @@ StorageLocalResourceProviderProcess::reconcileResourceProviderState()
       foreach (const Resource& resource, totalResources) {
         Resource unconverted = createRawDiskResource(
             info,
-            resource.scalar().value(),
+            Bytes(resource.scalar().value(), Bytes::MEGABYTES),
             resource.disk().source().has_profile()
               ? resource.disk().source().profile() : Option<string>::none(),
             resource.disk().source().has_id()
@@ -1808,7 +1808,7 @@ Future<Resources> StorageLocalResourceProviderProcess::discoverResources()
             foreach (const auto& entry, response.entries()) {
               resources += createRawDiskResource(
                   info,
-                  entry.volume_info().capacity_bytes(),
+                  Bytes(entry.volume_info().capacity_bytes()),
                   volumesToProfiles.contains(entry.volume_info().id())
                     ? volumesToProfiles.at(entry.volume_info().id())
                     : Option<string>::none(),
@@ -2307,7 +2307,7 @@ Future<Resources> StorageLocalResourceProviderProcess::getCapacities(
 
             return createRawDiskResource(
                 info,
-                response.available_capacity(),
+                Bytes(response.available_capacity()),
                 profile);
           })));
       }
@@ -2459,7 +2459,7 @@ StorageLocalResourceProviderProcess::applyCreateVolumeOrBlock(
         // RAW profiled resources afterward.
         created = createVolume(
             operationUuid.toString(),
-            resource.scalar().value(),
+            Bytes(resource.scalar().value(), Bytes::MEGABYTES),
             profiles.at(resource.disk().source().profile()));
       } else {
         // No need to call `ValidateVolumeCapabilities` sequentially
@@ -2486,7 +2486,7 @@ StorageLocalResourceProviderProcess::applyCreateVolumeOrBlock(
         // RAW profiled resources afterward.
         created = createVolume(
             operationUuid.toString(),
-            resource.scalar().value(),
+            Bytes(resource.scalar().value(), Bytes::MEGABYTES),
             profiles.at(resource.disk().source().profile()));
       } else {
         // No need to call `ValidateVolumeCapabilities` sequentially