Repository: mesos Updated Branches: refs/heads/master dbe1fbcba -> c65fb009e
Changed Device::path to optional and introduced Device::Number. A device in cgroup can be represented as either a path or a major:minor number. Need to change the `required` Device::path to `optional` to add Number in the device protobuf. Review: https://reviews.apache.org/r/60991/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/03b77fb4 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/03b77fb4 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/03b77fb4 Branch: refs/heads/master Commit: 03b77fb4643c5e7e2957ae09a5a6ca38b6407437 Parents: dbe1fbc Author: Gilbert Song <songzihao1...@gmail.com> Authored: Mon Jul 31 15:45:29 2017 -0700 Committer: Gilbert Song <songzihao1...@gmail.com> Committed: Mon Jul 31 15:45:29 2017 -0700 ---------------------------------------------------------------------- include/mesos/mesos.proto | 8 +++++++- include/mesos/v1/mesos.proto | 8 +++++++- .../mesos/isolators/cgroups/subsystems/devices.cpp | 6 ++++++ 3 files changed, 20 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/03b77fb4/include/mesos/mesos.proto ---------------------------------------------------------------------- diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto index 41e42b4..45253a3 100644 --- a/include/mesos/mesos.proto +++ b/include/mesos/mesos.proto @@ -3084,7 +3084,13 @@ message FileInfo { * Describes information abount a device. */ message Device { - required string path = 1; + message Number { + required uint64 major = 1; + required uint64 minor = 2; + } + + optional string path = 1; + optional Number number = 2; } http://git-wip-us.apache.org/repos/asf/mesos/blob/03b77fb4/include/mesos/v1/mesos.proto ---------------------------------------------------------------------- diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto index 9de282f..4dfc8b0 100644 --- a/include/mesos/v1/mesos.proto +++ b/include/mesos/v1/mesos.proto @@ -3067,7 +3067,13 @@ message FileInfo { * Describes information abount a device. */ message Device { - required string path = 1; + message Number { + required uint64 major = 1; + required uint64 minor = 2; + } + + optional string path = 1; + optional Number number = 2; } http://git-wip-us.apache.org/repos/asf/mesos/blob/03b77fb4/src/slave/containerizer/mesos/isolators/cgroups/subsystems/devices.cpp ---------------------------------------------------------------------- diff --git a/src/slave/containerizer/mesos/isolators/cgroups/subsystems/devices.cpp b/src/slave/containerizer/mesos/isolators/cgroups/subsystems/devices.cpp index ddf2a4d..4c43191 100644 --- a/src/slave/containerizer/mesos/isolators/cgroups/subsystems/devices.cpp +++ b/src/slave/containerizer/mesos/isolators/cgroups/subsystems/devices.cpp @@ -86,6 +86,12 @@ Try<Owned<Subsystem>> DevicesSubsystem::create( if (flags.allowed_devices.isSome()) { foreach (const DeviceAccess& device_access, flags.allowed_devices->allowed_devices()) { + if (!device_access.device().has_path()) { + VLOG(1) << "Skipping a whitelisted device since no device " + << "path is provided"; + continue; + } + string path = device_access.device().path(); const DeviceAccess_Access access = device_access.access(); bool readAccess = (access.has_read() && access.read());