This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 241bc6df2 [cgroups2] Make isolator status() return parent status for 
containers w/ !isolate.
241bc6df2 is described below

commit 241bc6df2ab61dbbffa0ae6c2a0c0de85a778bf4
Author: Jason Zhou <[email protected]>
AuthorDate: Thu Aug 15 18:33:22 2024 -0400

    [cgroups2] Make isolator status() return parent status for containers w/ 
!isolate.
    
    In cgroups1, if a container is sharing cgroups with its parents, we will
    return the parent's status.
    
    In cgroups2, we want to mimic this behavior even though we always create
    cgroups for our containers. Since we do not do anything with our
    container's cgroup if isolate == false.
    
    Review: https://reviews.apache.org/r/75175/
---
 src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp 
b/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
index b5424ba02..12842a055 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
@@ -824,7 +824,15 @@ Future<ResourceStatistics> Cgroups2IsolatorProcess::usage(
 Future<ContainerStatus> Cgroups2IsolatorProcess::status(
     const ContainerID& containerId)
 {
-  CHECK(infos.contains(containerId));
+  if (!infos.contains(containerId)) {
+    return Failure("Unknown container");
+  }
+
+  // If we are a nested container without isolation,
+  // we try to find the status of its ancestor.
+  if (!infos[containerId]->isolate) {
+    return status(containerId.parent());
+  }
 
   vector<Future<ContainerStatus>> statuses;
   foreachvalue (const Owned<Controller>& controller, controllers) {

Reply via email to