You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gi...@apache.org on 2019/08/14 05:57:44 UTC

[mesos] branch master updated: Made sure we are tracking ephemeral quota before getting the usage.

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

gilbert 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 ea95348  Made sure we are tracking ephemeral quota before getting the usage.
ea95348 is described below

commit ea953482f82131fcf033aca60145b1471ce4fcb2
Author: James Peach <jp...@apache.org>
AuthorDate: Tue Aug 13 22:57:30 2019 -0700

    Made sure we are tracking ephemeral quota before getting the usage.
    
    If there is no ephemeral disk resource, the `disk/du` isolator
    will not track ephemeral disk usage. In that case, we can't index
    the paths hash to find the last usage since it doesn't contain the
    ephemeral paths. The fix is to check, and omit the ephemeral usage
    if it is not being tracked.
    
    Review: https://reviews.apache.org/r/71283/
---
 .../containerizer/mesos/isolators/posix/disk.cpp    | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/slave/containerizer/mesos/isolators/posix/disk.cpp b/src/slave/containerizer/mesos/isolators/posix/disk.cpp
index 29bdbe6..4d8047b 100644
--- a/src/slave/containerizer/mesos/isolators/posix/disk.cpp
+++ b/src/slave/containerizer/mesos/isolators/posix/disk.cpp
@@ -463,16 +463,21 @@ Future<ResourceStatistics> PosixDiskIsolatorProcess::usage(
     }
   }
 
-  result.set_disk_used_bytes(info->ephemeralUsage().bytes());
+  // Note that if there is no disk resource, we aren't tracking
+  // any ephemeral usage either. Note that if the sandbox is
+  // present, all the ephemeral paths must also be present.
+  if (info->paths.contains(info->sandbox)) {
+    result.set_disk_used_bytes(info->ephemeralUsage().bytes());
 
-  // It doesn't matter which ephemeral path we use to get the quota,
-  // since it's replicated there.
-  result.set_disk_limit_bytes(
-      info->paths[info->sandbox].quota.disk()->bytes());
+    // It doesn't matter which ephemeral path we use to get the quota,
+    // since it's replicated there.
+    result.set_disk_limit_bytes(
+        info->paths[info->sandbox].quota.disk()->bytes());
 
-  DiskStatistics *statistics = result.add_disk_statistics();
-  statistics->set_limit_bytes(result.disk_limit_bytes());
-  statistics->set_used_bytes(result.disk_used_bytes());
+    DiskStatistics *statistics = result.add_disk_statistics();
+    statistics->set_limit_bytes(result.disk_limit_bytes());
+    statistics->set_used_bytes(result.disk_used_bytes());
+  }
 
   return result;
 }