This is an automated email from the ASF dual-hosted git repository.

chhsiao pushed a commit to branch 1.8.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 315340f5c287fa72d35011ba7fedabf91a66514d
Author: Chun-Hung Hsiao <[email protected]>
AuthorDate: Sat Apr 6 21:36:54 2019 -0700

    Fixed a container ID generation issue in the CSI service manager.
    
    Review: https://reviews.apache.org/r/70427
---
 src/csi/service_manager.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/csi/service_manager.cpp b/src/csi/service_manager.cpp
index 0a3663c..d6d0d4a 100644
--- a/src/csi/service_manager.cpp
+++ b/src/csi/service_manager.cpp
@@ -23,6 +23,7 @@
 #include <vector>
 
 #include <mesos/http.hpp>
+#include <mesos/type_utils.hpp>
 
 #include <mesos/agent/agent.hpp>
 
@@ -51,7 +52,6 @@
 
 #include "csi/paths.hpp"
 #include "csi/v0_client.hpp"
-#include "csi/v0_utils.hpp"
 
 #include "internal/devolve.hpp"
 #include "internal/evolve.hpp"
@@ -105,11 +105,19 @@ static ContainerID getContainerId(
     const string& containerPrefix,
     const CSIPluginContainerInfo& container)
 {
+  // NOTE: We cannot simply stringify `container.services()` since it returns
+  // `RepeatedField<int>`, so we reconstruct the list of services here.
+  vector<Service> services;
+  services.reserve(container.services_size());
+  for (int i = 0; i < container.services_size(); i++) {
+    services.push_back(container.services(i));
+  }
+
   ContainerID containerId;
   containerId.set_value(
       containerPrefix +
       strings::join("-", strings::replace(info.type(), ".", "-"), info.name()) 
+
-      "--" + strings::join("-", container.services()));
+      "--" + strings::join("-", services));
 
   return containerId;
 }

Reply via email to