You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gi...@apache.org on 2019/08/15 18:49:43 UTC
[mesos] 02/03: Moved const string `.secret` to paths.hpp.
This is an automated email from the ASF dual-hosted git repository.
gilbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 34330fb08466116c8483ce6de234126a6089a683
Author: Qian Zhang <zh...@gmail.com>
AuthorDate: Thu Aug 15 11:49:23 2019 -0700
Moved const string `.secret` to paths.hpp.
Review: https://reviews.apache.org/r/71221/
---
.../containerizer/mesos/isolators/volume/secret.cpp | 16 +++++++++-------
src/slave/containerizer/mesos/paths.hpp | 1 +
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/slave/containerizer/mesos/isolators/volume/secret.cpp b/src/slave/containerizer/mesos/isolators/volume/secret.cpp
index 5131ecb..91d7013 100644
--- a/src/slave/containerizer/mesos/isolators/volume/secret.cpp
+++ b/src/slave/containerizer/mesos/isolators/volume/secret.cpp
@@ -14,6 +14,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include "slave/containerizer/mesos/paths.hpp"
+
#include "slave/containerizer/mesos/isolators/volume/secret.hpp"
#include <sys/mount.h>
@@ -56,6 +58,8 @@ using mesos::internal::protobuf::slave::containerMountOperation;
using mesos::internal::protobuf::slave::containerRenameOperation;
using mesos::internal::protobuf::slave::createContainerMount;
+using mesos::internal::slave::containerizer::paths::SECRET_DIRECTORY;
+
using mesos::slave::ContainerClass;
using mesos::slave::ContainerConfig;
using mesos::slave::ContainerLaunchInfo;
@@ -67,9 +71,6 @@ namespace mesos {
namespace internal {
namespace slave {
-constexpr char SECRET_DIR[] = ".secret";
-
-
Try<Isolator*> VolumeSecretIsolatorProcess::create(
const Flags& flags,
SecretResolver* secretResolver)
@@ -79,7 +80,8 @@ Try<Isolator*> VolumeSecretIsolatorProcess::create(
return Error("Volume secret isolation requires filesystem/linux isolator.");
}
- const string hostSecretTmpDir = path::join(flags.runtime_dir, SECRET_DIR);
+ const string hostSecretTmpDir =
+ path::join(flags.runtime_dir, SECRET_DIRECTORY);
Try<Nothing> mkdir = os::mkdir(hostSecretTmpDir);
if (mkdir.isError()) {
@@ -131,7 +133,7 @@ Future<Option<ContainerLaunchInfo>> VolumeSecretIsolatorProcess::prepare(
const string containerDir = path::join(
flags.runtime_dir,
- SECRET_DIR,
+ SECRET_DIRECTORY,
stringify(containerId));
Try<Nothing> mkdir = os::mkdir(containerDir);
@@ -146,7 +148,7 @@ Future<Option<ContainerLaunchInfo>> VolumeSecretIsolatorProcess::prepare(
const string sandboxSecretRootDir =
path::join(containerConfig.directory(),
- SECRET_DIR + string("-") + stringify(id::UUID::random()));
+ SECRET_DIRECTORY + string("-") + stringify(id::UUID::random()));
// TODO(Kapil): Add some UUID suffix to the secret-root dir to avoid conflicts
// with user container_path.
@@ -309,7 +311,7 @@ Future<Nothing> VolumeSecretIsolatorProcess::cleanup(
{
const string containerDir = path::join(
flags.runtime_dir,
- SECRET_DIR,
+ SECRET_DIRECTORY,
stringify(containerId));
if (os::exists(containerDir)) {
diff --git a/src/slave/containerizer/mesos/paths.hpp b/src/slave/containerizer/mesos/paths.hpp
index c003335..e35d380 100644
--- a/src/slave/containerizer/mesos/paths.hpp
+++ b/src/slave/containerizer/mesos/paths.hpp
@@ -84,6 +84,7 @@ constexpr char CONTAINER_LAUNCH_INFO_FILE[] = "launch_info";
constexpr char STANDALONE_MARKER_FILE[] = "standalone.marker";
constexpr char CONTAINER_SHM_DIRECTORY[] = "shm";
constexpr char AGENT_SHM_DIRECTORY[] = "/dev/shm";
+constexpr char SECRET_DIRECTORY[] = ".secret";
enum Mode