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/05 03:56:29 UTC
[1/3] mesos git commit: Allowed relative path in
`Resource.disk.source.{path, mount}.root.
Repository: mesos
Updated Branches:
refs/heads/master 21c1f9366 -> 0e3509444
Allowed relative path in `Resource.disk.source.{path,mount}.root.
If the `root` field is set to a relative path, it would mean that the
path is relative to the agent work directory. This provides the ability
for a containerizer to construct the mount points of CSI volumes without
knowing the resource providers.
Review: https://reviews.apache.org/r/63498/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0e350944
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0e350944
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0e350944
Branch: refs/heads/master
Commit: 0e35094441656f2028d5dee7ab5ab33e63054889
Parents: 2fa447c
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
Authored: Mon Dec 4 19:35:37 2017 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Dec 4 19:56:22 2017 -0800
----------------------------------------------------------------------
CHANGELOG | 3 +++
docs/upgrades.md | 5 +++++
include/mesos/mesos.proto | 6 ++++--
include/mesos/v1/mesos.proto | 6 ++++--
src/slave/paths.cpp | 24 +++++++++++++++++-------
src/slave/paths.hpp | 4 ++--
6 files changed, 35 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/0e350944/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 0d68559..8b3d364 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,6 +14,9 @@ Additional API Changes:
* [MESOS-8165] Master will now send TASK_GONE status for unknown
tasks of PARTITION_AWARE frameworks belonging to registered agents
during explicit reconciliation.
+ * [MESOS-7550] The fields `Resource.disk.source.path.root` and
+ `Resource.disk.source.mount.root` can now be set to relative paths
+ to an agent's work directory.
Unresolved Critical Issues:
http://git-wip-us.apache.org/repos/asf/mesos/blob/0e350944/docs/upgrades.md
----------------------------------------------------------------------
diff --git a/docs/upgrades.md b/docs/upgrades.md
index 33ba4a6..7b77ef9 100644
--- a/docs/upgrades.md
+++ b/docs/upgrades.md
@@ -50,6 +50,7 @@ We categorize the changes as follows:
<ul style="padding-left:10px;">
<li>C <a href="#1-5-x-task-starting">Built-in executors send a TASK_STARTING update</a></li>
<li>A <a href="#1-5-x-network-ports-isolator">Network ports isolator</a></li>
+ <li>C <a href="#1-5-x-relative-disk-source-root-path">Relative source root paths for disk resources</a></li>
</ul>
</td>
@@ -382,6 +383,10 @@ We categorize the changes as follows:
* Agent flag `--executor_secret_key` has been deprecated. Operators should use `--jwt_secret_key` instead.
+<a name="1-5-x-relative-disk-source-root-path"></a>
+
+* The fields `Resource.disk.source.path.root` and `Resource.disk.source.mount.root` can now be set to relative paths to an agent's work directory. The containerizers will interpret the paths based on the `--work_dir` flag on an agent.
+
## Upgrading from 1.3.x to 1.4.x ##
<a name="1-4-x-ambient-capabilities"></a>
http://git-wip-us.apache.org/repos/asf/mesos/blob/0e350944/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index 11089b7..5b93478 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -1424,7 +1424,8 @@ message Resource {
// A folder that can be located on a separate disk device. This
// can be shared and carved up as necessary between frameworks.
message Path {
- // Path to the folder (e.g., /mnt/raid/disk0).
+ // Path to the folder (e.g., /mnt/raid/disk0). If the path is a
+ // relative path, it is relative to the agent work directory.
optional string root = 1;
}
@@ -1432,7 +1433,8 @@ message Resource {
// can only be used exclusively: a framework cannot accept a
// partial amount of this disk.
message Mount {
- // Path to mount point (e.g., /mnt/raid/disk0).
+ // Path to mount point (e.g., /mnt/raid/disk0). If the path is a
+ // relative path, it is relative to the agent work directory.
optional string root = 1;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0e350944/include/mesos/v1/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index c496da9..22b3c68 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -1405,7 +1405,8 @@ message Resource {
// A folder that can be located on a separate disk device. This
// can be shared and carved up as necessary between frameworks.
message Path {
- // Path to the folder (e.g., /mnt/raid/disk0).
+ // Path to the folder (e.g., /mnt/raid/disk0). If the path is a
+ // relative path, it is relative to the agent work directory.
optional string root = 1;
}
@@ -1413,7 +1414,8 @@ message Resource {
// can only be used exclusively: a framework cannot accept a
// partial amount of this disk.
message Mount {
- // Path to mount point (e.g., /mnt/raid/disk0).
+ // Path to mount point (e.g., /mnt/raid/disk0). If the path is a
+ // relative path, it is relative to the agent work directory.
optional string root = 1;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0e350944/src/slave/paths.cpp
----------------------------------------------------------------------
diff --git a/src/slave/paths.cpp b/src/slave/paths.cpp
index fce18c5..b8004e7 100644
--- a/src/slave/paths.cpp
+++ b/src/slave/paths.cpp
@@ -560,7 +560,7 @@ string getResourcesTargetPath(
string getPersistentVolumePath(
- const string& rootDir,
+ const string& workDir,
const string& role,
const string& persistenceId)
{
@@ -581,12 +581,12 @@ string getPersistentVolumePath(
string serializableRole = strings::replace(role, "/", " ");
return path::join(
- rootDir, "volumes", "roles", serializableRole, persistenceId);
+ workDir, "volumes", "roles", serializableRole, persistenceId);
}
string getPersistentVolumePath(
- const string& rootDir,
+ const string& workDir,
const Resource& volume)
{
CHECK_GT(volume.reservations_size(), 0);
@@ -602,10 +602,10 @@ string getPersistentVolumePath(
// If no `source` is provided in `DiskInfo` volumes are mapped into
- // the `rootDir`.
+ // the `workDir`.
if (!volume.disk().has_source()) {
return getPersistentVolumePath(
- rootDir,
+ workDir,
role,
volume.disk().persistence().id());
}
@@ -618,8 +618,13 @@ string getPersistentVolumePath(
// For `PATH` we mount a directory inside the `root`.
CHECK(volume.disk().source().has_path());
CHECK(volume.disk().source().path().has_root());
+ string root = volume.disk().source().path().root();
+ if (!path::absolute(root)) {
+ // A relative path in `root` is relative to agent work dir.
+ root = path::join(workDir, root);
+ }
return getPersistentVolumePath(
- volume.disk().source().path().root(),
+ root,
role,
volume.disk().persistence().id());
}
@@ -627,7 +632,12 @@ string getPersistentVolumePath(
// For `MOUNT` we map straight onto the root of the mount.
CHECK(volume.disk().source().has_mount());
CHECK(volume.disk().source().mount().has_root());
- return volume.disk().source().mount().root();
+ string root = volume.disk().source().mount().root();
+ if (!path::absolute(root)) {
+ // A relative path in `root` is relative to agent work dir.
+ root = path::join(workDir, root);
+ }
+ return root;
}
case Resource::DiskInfo::Source::BLOCK:
case Resource::DiskInfo::Source::RAW:
http://git-wip-us.apache.org/repos/asf/mesos/blob/0e350944/src/slave/paths.hpp
----------------------------------------------------------------------
diff --git a/src/slave/paths.hpp b/src/slave/paths.hpp
index c73130fd..d645d87 100644
--- a/src/slave/paths.hpp
+++ b/src/slave/paths.hpp
@@ -358,13 +358,13 @@ std::string getResourcesTargetPath(
std::string getPersistentVolumePath(
- const std::string& rootDir,
+ const std::string& workDir,
const std::string& role,
const std::string& persistenceId);
std::string getPersistentVolumePath(
- const std::string& rootDir,
+ const std::string& workDir,
const Resource& resource);
[2/3] mesos git commit: Fixed resources tracking under roles when
removing offer operations.
Posted by ji...@apache.org.
Fixed resources tracking under roles when removing offer operations.
Review: https://reviews.apache.org/r/64322/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2fa447c5
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2fa447c5
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2fa447c5
Branch: refs/heads/master
Commit: 2fa447c5fb1ffcce1c08e4039d156513bdd5187d
Parents: dc8c8da
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
Authored: Mon Dec 4 19:27:55 2017 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Dec 4 19:56:22 2017 -0800
----------------------------------------------------------------------
src/master/master.cpp | 5 +++++
src/master/master.hpp | 5 +++++
2 files changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/2fa447c5/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 883793a..31991b5 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -9241,6 +9241,11 @@ void Master::removeFramework(Framework* framework)
}
}
+ foreachvalue (OfferOperation* operation,
+ utils::copy(framework->offerOperations)) {
+ framework->removeOfferOperation(operation);
+ }
+
// TODO(benh): Similar code between removeFramework and
// failoverFramework needs to be shared!
http://git-wip-us.apache.org/repos/asf/mesos/blob/2fa447c5/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index c3bc0b5..448be3b 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -2580,6 +2580,11 @@ struct Framework
<< "' (uuid: " << uuid->toString() << ") "
<< "of framework " << operation->framework_id();
+ if (!protobuf::isSpeculativeOperation(operation->info()) &&
+ !protobuf::isTerminalState(operation->latest_status().state())) {
+ recoverResources(operation);
+ }
+
offerOperations.erase(uuid.get());
}
[3/3] mesos git commit: Fixed the code to track resources under roles
for offer operations.
Posted by ji...@apache.org.
Fixed the code to track resources under roles for offer operations.
Review: https://reviews.apache.org/r/64320/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/dc8c8da2
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/dc8c8da2
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/dc8c8da2
Branch: refs/heads/master
Commit: dc8c8da2a61069033f22400ddd8f4080a2ff1958
Parents: 21c1f93
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
Authored: Mon Dec 4 18:18:30 2017 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Dec 4 19:56:22 2017 -0800
----------------------------------------------------------------------
src/master/master.hpp | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/dc8c8da2/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index 5d2ae65..c3bc0b5 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -2518,14 +2518,8 @@ struct Framework
// role is absent from the framework's set of roles. In this
// case, we track the role's allocation for this framework.
foreachkey (const std::string& role, consumed->allocations()) {
- auto allocatedToRole = [&role](const Resource& resource) {
- return resource.allocation_info().role() == role;
- };
-
- if (roles.count(role) == 0 &&
- totalUsedResources.filter(allocatedToRole).empty()) {
- CHECK(totalOfferedResources.filter(allocatedToRole).empty());
- untrackUnderRole(role);
+ if (!isTrackedUnderRole(role)) {
+ trackUnderRole(role);
}
}
}