You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2016/03/01 22:28:27 UTC
[1/2] mesos git commit: Windows: Launch: Removed `rootfs` launcher
flag, preventing `chroot`.
Repository: mesos
Updated Branches:
refs/heads/master c7dea5888 -> b8e130216
Windows: Launch: Removed `rootfs` launcher flag, preventing `chroot`.
`chroot` does not exist on Windows. Unfortunately, the launcher also
depends on it. In this commit, we removed Windows support for the
launcher flag `rootfs`, which controls whether we use `chroot` in the
launcher. This allows us to divest ourselves of `chroot` altogether on
Windows.
Review: https://reviews.apache.org/r/43904/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b8e13021
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b8e13021
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b8e13021
Branch: refs/heads/master
Commit: b8e130216b1e1d6ea1b601cd52d96a8388c85e42
Parents: ff90803
Author: Alex Clemmer <cl...@gmail.com>
Authored: Tue Mar 1 11:30:03 2016 -0800
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Tue Mar 1 13:28:20 2016 -0800
----------------------------------------------------------------------
src/slave/containerizer/mesos/containerizer.cpp | 8 ++++++
src/slave/containerizer/mesos/launch.cpp | 27 ++++++++++++++------
src/slave/containerizer/mesos/launch.hpp | 2 ++
3 files changed, 29 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/b8e13021/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index 129406a..db3d504 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -1062,7 +1062,15 @@ Future<bool> MesosContainerizerProcess::__launch(
launchFlags.working_directory = workingDirectory;
}
+#ifdef __WINDOWS__
+ if (!rootfs.isNone()) {
+ return Failure(
+ "`chroot` is not supported on Windows, but the `ContainerLaunchInfo` "
+ "provided a `rootfs` flag to the launcher");
+ }
+#else
launchFlags.rootfs = rootfs;
+#endif // __WINDOWS__
launchFlags.user = user;
launchFlags.pipe_read = pipes[0];
launchFlags.pipe_write = pipes[1];
http://git-wip-us.apache.org/repos/asf/mesos/blob/b8e13021/src/slave/containerizer/mesos/launch.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launch.cpp b/src/slave/containerizer/mesos/launch.cpp
index 6b3bf16..868be60 100644
--- a/src/slave/containerizer/mesos/launch.cpp
+++ b/src/slave/containerizer/mesos/launch.cpp
@@ -61,12 +61,14 @@ MesosContainerizerLaunch::Flags::Flags()
"The working directory for the executor. It will be ignored if\n"
"container root filesystem is not specified.");
+#ifndef __WINDOWS__
add(&rootfs,
"rootfs",
"Absolute path to the container root filesystem.\n"
"The command and sandbox flags are interpreted relative\n"
"to rootfs\n"
"Different platforms may implement 'chroot' differently.");
+#endif // __WINDOWS__
add(&user,
"user",
@@ -210,12 +212,19 @@ int MesosContainerizerLaunch::execute()
}
}
+#ifdef __WINDOWS__
+ // Not supported on Windows.
+ const Option<std::string> rootfs = None();
+#else
+ const Option<std::string> rootfs = flags.rootfs;
+#endif // __WINDOWS__
+
// Change root to a new root, if provided.
- if (flags.rootfs.isSome()) {
- cout << "Changing root to " << flags.rootfs.get() << endl;
+ if (rootfs.isSome()) {
+ cout << "Changing root to " << rootfs.get() << endl;
// Verify that rootfs is an absolute path.
- Result<string> realpath = os::realpath(flags.rootfs.get());
+ Result<string> realpath = os::realpath(rootfs.get());
if (realpath.isError()) {
cerr << "Failed to determine if rootfs is an absolute path: "
<< realpath.error() << endl;
@@ -223,18 +232,20 @@ int MesosContainerizerLaunch::execute()
} else if (realpath.isNone()) {
cerr << "Rootfs path does not exist" << endl;
return 1;
- } else if (realpath.get() != flags.rootfs.get()) {
+ } else if (realpath.get() != rootfs.get()) {
cerr << "Rootfs path is not an absolute path" << endl;
return 1;
}
#ifdef __linux__
- Try<Nothing> chroot = fs::chroot::enter(flags.rootfs.get());
+ Try<Nothing> chroot = fs::chroot::enter(rootfs.get());
+#elif defined(__WINDOWS__)
+ Try<Nothing> chroot = Error("`chroot` not supported on Windows");
#else // For any other platform we'll just use POSIX chroot.
- Try<Nothing> chroot = os::chroot(flags.rootfs.get());
+ Try<Nothing> chroot = os::chroot(rootfs.get());
#endif // __linux__
if (chroot.isError()) {
- cerr << "Failed to enter chroot '" << flags.rootfs.get()
+ cerr << "Failed to enter chroot '" << rootfs.get()
<< "': " << chroot.error();
return 1;
}
@@ -256,7 +267,7 @@ int MesosContainerizerLaunch::execute()
// Determine the current working directory for the executor.
string cwd;
- if (flags.rootfs.isSome() && flags.working_directory.isSome()) {
+ if (rootfs.isSome() && flags.working_directory.isSome()) {
cwd = flags.working_directory.get();
} else {
cwd = flags.sandbox.get();
http://git-wip-us.apache.org/repos/asf/mesos/blob/b8e13021/src/slave/containerizer/mesos/launch.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launch.hpp b/src/slave/containerizer/mesos/launch.hpp
index 7e29ca2..8fcb58b 100644
--- a/src/slave/containerizer/mesos/launch.hpp
+++ b/src/slave/containerizer/mesos/launch.hpp
@@ -37,7 +37,9 @@ public:
Option<JSON::Object> command;
Option<std::string> sandbox;
Option<std::string> working_directory;
+#ifndef __WINDOWS__
Option<std::string> rootfs;
+#endif // __WINDOWS__
Option<std::string> user;
Option<int> pipe_read;
Option<int> pipe_write;
[2/2] mesos git commit: Stout: Added `WindowsError` constructor to
`Result`.
Posted by jo...@apache.org.
Stout: Added `WindowsError` constructor to `Result`.
Review: https://reviews.apache.org/r/43903/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ff90803b
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ff90803b
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ff90803b
Branch: refs/heads/master
Commit: ff90803bfba932e7fd4c578cbdc9b83f6ecc2a34
Parents: c7dea58
Author: Alex Clemmer <cl...@gmail.com>
Authored: Tue Mar 1 11:29:58 2016 -0800
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Tue Mar 1 13:28:20 2016 -0800
----------------------------------------------------------------------
3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff90803b/3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp
index 577c8e4..5d93ee0 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp
@@ -85,6 +85,11 @@ public:
Result(const ErrnoError& error)
: data(error) {}
+#ifdef __WINDOWS__
+ Result(const WindowsError& error)
+ : data(error) {}
+#endif // __WINDOWS__
+
// We don't need to implement these because we are leveraging
// Try<Option<T>>.
Result(const Result<T>& that) = default;