(mesos) branch master updated: Removed `-k` option when installing Ruby

2024-03-19 Thread qianzhang
This is an automated email from the ASF dual-hosted git repository.

qianzhang 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 b54ff0f1d Removed `-k` option when installing Ruby
b54ff0f1d is described below

commit b54ff0f1d181c03bbf68009d80499d9f184584b6
Author: Qian Zhang 
AuthorDate: Wed Mar 20 10:50:25 2024 +0800

Removed `-k` option when installing Ruby
---
 support/mesos-website/Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/mesos-website/Dockerfile b/support/mesos-website/Dockerfile
index 617883e0c..2ffed3cc9 100644
--- a/support/mesos-website/Dockerfile
+++ b/support/mesos-website/Dockerfile
@@ -20,7 +20,7 @@ RUN apt-get update && \
 # Install ruby version manager to get a more updated ruby version  
  
 RUN curl -sSL https://rvm.io/mpapis.asc | gpg --import - && \
 curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - && \ 
-curl -k -sSL https://get.rvm.io | bash -s stable --ruby=2.6.6 
+curl -sSL https://get.rvm.io | bash -s stable --ruby=2.6.6 
 
 ENV PATH=/usr/local/rvm/rubies/ruby-2.6.6/bin:$PATH
 



(mesos) branch master updated: [cgroups2] Convert cgroups2::read/write to template functions.

2024-03-19 Thread bmahler
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 67fbfe0c4 [cgroups2] Convert cgroups2::read/write to template 
functions.
67fbfe0c4 is described below

commit 67fbfe0c4fc37548399378cd4e89d6bdd2b03335
Author: Devin Leamy 
AuthorDate: Tue Mar 19 18:04:42 2024 -0400

[cgroups2] Convert cgroups2::read/write to template functions.

To allow overloading of `read` by return type alone, we define
`cgroups::read` as a template function. For consistency, we do
the same for `cgroups::write`.

This closes #526
---
 src/linux/cgroups2.cpp | 25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/linux/cgroups2.cpp b/src/linux/cgroups2.cpp
index e599c8c62..88060e02b 100644
--- a/src/linux/cgroups2.cpp
+++ b/src/linux/cgroups2.cpp
@@ -44,14 +44,16 @@ const string FILE_SYSTEM = "cgroup2";
 // Mount point for the cgroups2 file system.
 const string MOUNT_POINT = "/sys/fs/cgroup";
 
-// Forward declaration.
-Try read(const string& cgroup, const string& control);
 
-// Forward declaration.
+template 
+Try read(const string& cgroup, const string& control);
+
+template 
 Try write(
 const string& cgroup,
 const string& control,
-const string& value);
+const T& value);
+
 
 namespace control {
 
@@ -141,16 +143,18 @@ std::ostream& operator<<(std::ostream& stream, const 
State& state)
 } // namespace control {
 
 
+template <>
 Try read(const string& cgroup, const string& control)
 {
   return os::read(path::join(cgroups2::MOUNT_POINT, cgroup, control));
 }
 
 
+template <>
 Try write(
-  const string& cgroup,
-  const string& control,
-  const string& value)
+const string& cgroup,
+const string& control,
+const string& value)
 {
   return os::write(path::join(cgroups2::MOUNT_POINT, cgroup, control), value);
 }
@@ -328,7 +332,8 @@ namespace controllers {
 
 Try> available(const string& cgroup)
 {
-  Try contents = cgroups2::read(cgroup, 
cgroups2::control::CONTROLLERS);
+  Try contents =
+cgroups2::read(cgroup, cgroups2::control::CONTROLLERS);
 
   if (contents.isError()) {
 return Error("Failed to read cgroup.controllers in '" + cgroup + "': "
@@ -345,7 +350,7 @@ Try> available(const string& cgroup)
 Try enable(const string& cgroup, const vector& controllers)
 {
   Try contents =
-cgroups2::read(cgroup, cgroups2::control::SUBTREE_CONTROLLERS);
+cgroups2::read(cgroup, cgroups2::control::SUBTREE_CONTROLLERS);
 
   if (contents.isError()) {
 return Error(contents.error());
@@ -364,7 +369,7 @@ Try enable(const string& cgroup, const 
vector& controllers)
 Try> enabled(const string& cgroup)
 {
   Try contents =
-cgroups2::read(cgroup, cgroups2::control::SUBTREE_CONTROLLERS);
+cgroups2::read(cgroup, cgroups2::control::SUBTREE_CONTROLLERS);
   if (contents.isError()) {
 return Error("Failed to read 'cgroup.subtree_control' in '" + cgroup + "'"
  ": " + contents.error());



(mesos) branch master updated: [cgroups2] Introduces cgroups2::exists to check if a cgroup exists.

2024-03-19 Thread bmahler
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 442a1397f [cgroups2] Introduces cgroups2::exists to check if a cgroup 
exists.
442a1397f is described below

commit 442a1397fa4872164806415c7f7cd80efd288070
Author: Devin Leamy 
AuthorDate: Tue Mar 19 19:37:48 2024 +

[cgroups2] Introduces cgroups2::exists to check if a cgroup exists.

If you call `cgroups2::destroy` on a cgroup that does not exist, it
will throw an error. This is expected. However, it means that the
caller needs to know whether a cgroup exists. This PR introduces
`cgroups2::exists`, allowing the caller find out if a cgroup exists.

This is useful, for example, for test fixtures where cgroups
from a previous run of a test may or may not be cleaned up, depending
on whether or not the test was successful.
---
 src/linux/cgroups2.cpp | 13 +
 src/linux/cgroups2.hpp |  4 
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/linux/cgroups2.cpp b/src/linux/cgroups2.cpp
index e5011e23c..e599c8c62 100644
--- a/src/linux/cgroups2.cpp
+++ b/src/linux/cgroups2.cpp
@@ -243,6 +243,12 @@ Try unmount()
 }
 
 
+bool exists(const string& cgroup)
+{
+  return os::exists(path::join(MOUNT_POINT, cgroup));
+}
+
+
 Try create(const string& cgroup, bool recursive)
 {
   const string absolutePath = path::join(MOUNT_POINT, cgroup);
@@ -259,12 +265,11 @@ Try create(const string& cgroup, bool recursive)
 
 Try destroy(const string& cgroup)
 {
-  const string absolutePath = path::join(MOUNT_POINT, cgroup);
-
-  if (!os::exists(absolutePath)) {
-return Error("There does not exist a cgroup at '" + absolutePath + "'");
+  if (!cgroups2::exists(cgroup)) {
+return Error("Cgroup '" + cgroup + "' does not exist");
   }
 
+  const string absolutePath = path::join(MOUNT_POINT, cgroup);
   Try rmdir = os::rmdir(absolutePath, false);
   if (rmdir.isError()) {
 return Error("Failed to remove directory '" + absolutePath + "': "
diff --git a/src/linux/cgroups2.hpp b/src/linux/cgroups2.hpp
index a1f0a66d5..35519cc60 100644
--- a/src/linux/cgroups2.hpp
+++ b/src/linux/cgroups2.hpp
@@ -50,6 +50,10 @@ Try mounted();
 Try unmount();
 
 
+// Check if a cgroup exists.
+bool exists(const std::string& cgroup);
+
+
 // Creates a cgroup off of the base hierarchy, i.e. /sys/fs/cgroup/.
 // cgroup can be a nested cgroup (e.g. foo/bar/baz). If cgroup is a nested
 // cgroup and the parent cgroups do not exist, an error will be returned unless



(mesos) branch master updated (a507a2dc9 -> 354bf4898)

2024-03-19 Thread bmahler
This is an automated email from the ASF dual-hosted git repository.

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


from a507a2dc9 [cgroups2] Use rmdir instead of rm -rf to delete a cgroup.
 add 354bf4898 [cgroups2] Introduces API to move a process into a cgroup, 
by PID.

No new revisions were added by this update.

Summary of changes:
 src/linux/cgroups2.cpp | 45 ++
 src/linux/cgroups2.hpp | 10 +++
 src/tests/containerizer/cgroups2_tests.cpp | 33 ++
 3 files changed, 88 insertions(+)



(mesos) branch master updated: [cgroups2] Use rmdir instead of rm -rf to delete a cgroup.

2024-03-19 Thread bmahler
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 a507a2dc9 [cgroups2] Use rmdir instead of rm -rf to delete a cgroup.
a507a2dc9 is described below

commit a507a2dc95c9e6da6fe1947f65d245b5e3a856f0
Author: Devin Leamy 
AuthorDate: Tue Mar 19 19:18:25 2024 +

[cgroups2] Use rmdir instead of rm -rf to delete a cgroup.

Even with `sudo` permissions, `rm -rf` fails with "Operation not
permitted" when deleting a directory inside of `/sys/fs/cgroup`.
On the other hand, `sudo rmdir` does not fail.

`os::rmdir` uses `rm -rf` when `recursive=true` and `rmdir` when
`recursive=false`. Hence, we set `recursive=false` so cgroups
can be removed.
---
 src/linux/cgroups2.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/linux/cgroups2.cpp b/src/linux/cgroups2.cpp
index e5b9db817..73d484ea2 100644
--- a/src/linux/cgroups2.cpp
+++ b/src/linux/cgroups2.cpp
@@ -265,7 +265,7 @@ Try destroy(const string& cgroup)
 return Error("There does not exist a cgroup at '" + absolutePath + "'");
   }
 
-  Try rmdir = os::rmdir(absolutePath);
+  Try rmdir = os::rmdir(absolutePath, false);
   if (rmdir.isError()) {
 return Error("Failed to remove directory '" + absolutePath + "': "
  + rmdir.error());



(mesos) branch master updated (b4cbd9aa2 -> 895f05522)

2024-03-19 Thread bmahler
This is an automated email from the ASF dual-hosted git repository.

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


from b4cbd9aa2 [cgroups2] Introduces cgroups2::create() to create new 
cgroups.
 add 895f05522 [cgroups2] Introduced cgroups2::destroy() to remove a cgroup.

No new revisions were added by this update.

Summary of changes:
 src/linux/cgroups2.cpp | 18 ++
 src/linux/cgroups2.hpp |  5 +
 2 files changed, 23 insertions(+)