You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2018/01/03 07:17:29 UTC

[5/5] mesos git commit: Upgraded resources that come from `protobuf::read`.

Upgraded resources that come from `protobuf::read`.

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


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

Branch: refs/heads/1.5.x
Commit: 0ad8f8d084d4ce19654d19b3b9f5473e943fb94a
Parents: 0dbb4cf
Author: Michael Park <mp...@apache.org>
Authored: Fri Dec 15 18:12:57 2017 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Tue Jan 2 23:04:47 2018 -0800

----------------------------------------------------------------------
 src/resource_provider/storage/provider.cpp | 20 +++++++++++++++++---
 src/slave/containerizer/mesos/paths.cpp    | 23 +++++++++++++++++++++--
 2 files changed, 38 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/0ad8f8d0/src/resource_provider/storage/provider.cpp
----------------------------------------------------------------------
diff --git a/src/resource_provider/storage/provider.cpp b/src/resource_provider/storage/provider.cpp
index ee9ac90..e260872 100644
--- a/src/resource_provider/storage/provider.cpp
+++ b/src/resource_provider/storage/provider.cpp
@@ -714,9 +714,13 @@ Future<Nothing> StorageLocalResourceProviderProcess::recoverServices()
               configPath + "': " + config.error());
         }
 
-        if (config.isSome() &&
-            getCSIPluginContainerInfo(info, containerId) == config.get()) {
-          continue;
+        if (config.isSome()) {
+          convertResourceFormat(
+              config->mutable_resources(), POST_RESERVATION_REFINEMENT);
+
+          if (getCSIPluginContainerInfo(info, containerId) == config.get()) {
+            continue;
+          }
         }
       }
     }
@@ -912,6 +916,16 @@ StorageLocalResourceProviderProcess::recoverResourceProviderState()
     }
 
     if (resourceProviderState.isSome()) {
+      foreach (
+          Operation& operation,
+          resourceProviderState->mutable_operations()) {
+        upgradeResources(operation.mutable_info());
+      }
+
+      convertResourceFormat(
+          resourceProviderState->mutable_resources(),
+          POST_RESERVATION_REFINEMENT);
+
       foreach (const Operation& operation,
                resourceProviderState->operations()) {
         Try<id::UUID> uuid = id::UUID::fromBytes(operation.uuid().value());

http://git-wip-us.apache.org/repos/asf/mesos/blob/0ad8f8d0/src/slave/containerizer/mesos/paths.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/paths.cpp b/src/slave/containerizer/mesos/paths.cpp
index 8a188a9..d6ea618 100644
--- a/src/slave/containerizer/mesos/paths.cpp
+++ b/src/slave/containerizer/mesos/paths.cpp
@@ -20,6 +20,7 @@
 #include <stout/protobuf.hpp>
 
 #include "common/protobuf_utils.hpp"
+#include "common/resources_utils.hpp"
 
 #include "slave/containerizer/mesos/paths.hpp"
 
@@ -275,7 +276,7 @@ Result<ContainerTermination> getContainerTermination(
     return None();
   }
 
-  const Result<ContainerTermination>& termination =
+  Result<ContainerTermination> termination =
     ::protobuf::read<ContainerTermination>(path);
 
   if (termination.isError()) {
@@ -283,6 +284,11 @@ Result<ContainerTermination> getContainerTermination(
                  termination.error());
   }
 
+  if (termination.isSome()) {
+    convertResourceFormat(
+        termination->mutable_limited_resources(), POST_RESERVATION_REFINEMENT);
+  }
+
   return termination;
 }
 
@@ -323,7 +329,7 @@ Result<ContainerConfig> getContainerConfig(
     return None();
   }
 
-  const Result<ContainerConfig>& containerConfig =
+  Result<ContainerConfig> containerConfig =
     ::protobuf::read<ContainerConfig>(path);
 
   if (containerConfig.isError()) {
@@ -331,6 +337,19 @@ Result<ContainerConfig> getContainerConfig(
                  containerConfig.error());
   }
 
+  if (containerConfig.isSome()) {
+    convertResourceFormat(
+        containerConfig->mutable_executor_info()->mutable_resources(),
+        POST_RESERVATION_REFINEMENT);
+
+    convertResourceFormat(
+        containerConfig->mutable_task_info()->mutable_resources(),
+        POST_RESERVATION_REFINEMENT);
+
+    convertResourceFormat(
+        containerConfig->mutable_resources(), POST_RESERVATION_REFINEMENT);
+  }
+
   return containerConfig;
 }