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 0d484a2e4 [device manager] Add args to customize 
commit_device_access_changes behavior.
0d484a2e4 is described below

commit 0d484a2e46d98a271e6db7e4d291284c381176f1
Author: Jason Zhou <[email protected]>
AuthorDate: Thu Aug 8 12:53:43 2024 -0400

    [device manager] Add args to customize commit_device_access_changes 
behavior.
    
    Currently, commit_device_access_changes always checkpoints the
    device manager state **and** configures the bpf programs for the cgroup
    based on its device access state.
    
    We add an argument to commit_device_access_changes for the caller to
    determine whether they want the state to be checkpointed along with
    attaching the ebpf program.
    
    Review: https://reviews.apache.org/r/75148/
---
 .../containerizer/device_manager/device_manager.cpp      | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/slave/containerizer/device_manager/device_manager.cpp 
b/src/slave/containerizer/device_manager/device_manager.cpp
index a2b6b9cd6..8ffbf5ad1 100644
--- a/src/slave/containerizer/device_manager/device_manager.cpp
+++ b/src/slave/containerizer/device_manager/device_manager.cpp
@@ -256,16 +256,20 @@ private:
     return Nothing();
   }
 
-  Try<Nothing> commit_device_access_changes(const string& cgroup) const
+  Try<Nothing> commit_device_access_changes(
+      const string& cgroup,
+      bool write_checkpoint = true) const
   {
-    Try<Nothing> status = checkpoint();
+    if (write_checkpoint) {
+      Try<Nothing> status = checkpoint();
 
-    if (status.isError()) {
-      return Error("Failed to checkpoint device access state: "
-                   + status.error());
+      if (status.isError()) {
+        return Error("Failed to checkpoint device access state: "
+                    + status.error());
+      }
     }
 
-    status = cgroups2::devices::configure(
+    Try<Nothing> status = cgroups2::devices::configure(
         cgroup,
         device_access_per_cgroup.at(cgroup).allow_list,
         device_access_per_cgroup.at(cgroup).deny_list);

Reply via email to