Fixed a couple of minor network/ports isolator issues. Added a log message (similar to the one in the `cgroup/cpu` isolator to track then the resouces for a container are updated.
Hoisted a `CHECK` so that it happens before accessing the protobuf field it is protecting. Review: https://reviews.apache.org/r/65105/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/73fc5630 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/73fc5630 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/73fc5630 Branch: refs/heads/master Commit: 73fc563005aec597d840cc20233e230b3806702e Parents: ff14433 Author: James Peach <jpe...@apache.org> Authored: Tue Jan 16 08:35:49 2018 -0800 Committer: James Peach <jpe...@apache.org> Committed: Tue Jan 16 09:00:45 2018 -0800 ---------------------------------------------------------------------- src/slave/containerizer/mesos/isolators/network/ports.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/73fc5630/src/slave/containerizer/mesos/isolators/network/ports.cpp ---------------------------------------------------------------------- diff --git a/src/slave/containerizer/mesos/isolators/network/ports.cpp b/src/slave/containerizer/mesos/isolators/network/ports.cpp index 7d5ff4f..d9f8370 100644 --- a/src/slave/containerizer/mesos/isolators/network/ports.cpp +++ b/src/slave/containerizer/mesos/isolators/network/ports.cpp @@ -398,15 +398,15 @@ Future<Nothing> NetworkPortsIsolatorProcess::recover( CHECK(!infos.contains(state.container_id())) << "Duplicate ContainerID " << state.container_id(); + // A root level container ought to always have an executor_info. + CHECK(state.has_executor_info()); + if (!cniIsolatorEnabled) { infos.emplace(state.container_id(), Owned<Info>(new Info())); update(state.container_id(), state.executor_info().resources()); continue; } - // A root level container ought to always have an executor_info. - CHECK(state.has_executor_info()); - // Ignore containers that will be network isolated by the // `network/cni` isolator on the rationale that they ought // to be getting a per-container IP address. @@ -525,6 +525,9 @@ Future<Nothing> NetworkPortsIsolatorProcess::update( info->ports = IntervalSet<uint16_t>(); } + LOG(INFO) << "Updated ports to " << intervalSetToRanges(info->ports.get()) + << " for container " << containerId; + return Nothing(); }