]> git.ipfire.org Git - thirdparty/libcgroup.git/log
thirdparty/libcgroup.git
4 years agoabstraction-map: Add cpu.cfs_{quota,period}_us <-> cpu.max mapping
Tom Hromatka [Mon, 31 Jan 2022 16:21:54 +0000 (09:21 -0700)] 
abstraction-map: Add cpu.cfs_{quota,period}_us <-> cpu.max mapping

Add custom functions to map cpu.cfs_quota_us <-> cpu.max and
cpu.cfs_period_us <-> cpu.max.  These mappings can be 1->N or
N->1 and utilize custom values for limits, "-1" in cgroup v1
and "max" in cgroup v2.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agowrapper: Add function to remove name/value pair from a controller
Tom Hromatka [Wed, 15 Dec 2021 20:39:52 +0000 (20:39 +0000)] 
wrapper: Add function to remove name/value pair from a controller

Add a function to remove a name/value settings pair from
a cgroup_controller instance.  As part of this change, I did a small
refactor on cgroup_free_controllers() to make the code more reusable
throughout libcgroup.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoapi.c: Add const qualifier to parameters in cgroup_read_value_begin()
Tom Hromatka [Wed, 15 Dec 2021 20:39:22 +0000 (20:39 +0000)] 
api.c: Add const qualifier to parameters in cgroup_read_value_begin()

Make two string parameters passed into cgroup_read_value_begin()
fully constant, i.e. const char * const.  These parameters,
controller and name, are only used as read-only variables
within cgroup_read_value_begin() and are not intended to be
modified.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoapi.c/wrapper/abstraction: Save previous setting name in control_value
Tom Hromatka [Wed, 15 Dec 2021 20:37:37 +0000 (20:37 +0000)] 
api.c/wrapper/abstraction: Save previous setting name in control_value

When there's an N->1 mapping, the abstraction layer needs
to know which "1" setting to map back to.  Add a field to
struct control_value that saves off the original setting,
so that the abstraction layer can know how to map back from
an N->1 setting.

A good example of this is cpu.max/cpu.cfs_quota_us.  The
abstraction layer will map cpu.cfs_quota_us to cpu.max.
During the return conversion, the abstraction layer needs
to know whether to map cpu.max to cfs_quota_us or
cfs_period_us.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoabstraction: Add passthrough function
Tom Hromatka [Wed, 15 Dec 2021 21:12:09 +0000 (21:12 +0000)] 
abstraction: Add passthrough function

Add a passthrough function for settings/values that require
no conversion.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoabstraction: Add name conversion function
Tom Hromatka [Wed, 15 Dec 2021 21:11:28 +0000 (21:11 +0000)] 
abstraction: Add name conversion function

Add a function to the abstraction layer that can convert from
one cgroup setting name to another setting name.  The values are
not adjusted by this function.  For example, this can be used for
conversions like cpuset.effective_cpus to cpuset.cpus.effective.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agocgxset: Introduce cgxset
Tom Hromatka [Fri, 28 Jan 2022 17:22:49 +0000 (10:22 -0700)] 
cgxset: Introduce cgxset

Add a new libcgroup tool - cgxset.  cgxset is based upon cgset,
but it supports converting from cgroup version to another.

For example, a request like the following will work on a system
running the cgroup v1 cpu controller or the cgroup v2 cpu
controller.
            $ cgxset -2 -r cpu.weight=42 MyCgroup

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agocgxget: Introduce cgxget
Tom Hromatka [Fri, 28 Jan 2022 17:22:11 +0000 (10:22 -0700)] 
cgxget: Introduce cgxget

Add a new libcgroup tool - cgxget.  cgxget is based upon cgget,
but it supports converting from cgroup version to another.

For example, a request like the following will work on a system
running the cgroup v1 cpu controller or the cgroup v2 cpu controller.
$ cgxget -2 -r cpu.weight MyCgroup

The return value to the user will match the cgroup version requested.
If the user requests a v1 setting, the return value will be a cgroup
v1 setting.  If the user requests a v2 setting, the return value will
be a cgroup v2 setting.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoabstraction-map: Add cpu.shares <-> cpu.weight mapping
Tom Hromatka [Wed, 15 Dec 2021 20:19:23 +0000 (20:19 +0000)] 
abstraction-map: Add cpu.shares <-> cpu.weight mapping

Add a mapping from cpu.shares <-> cpu.weight.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoabstraction: Add function to convert from one cgroup version to another
Tom Hromatka [Wed, 15 Dec 2021 20:18:54 +0000 (20:18 +0000)] 
abstraction: Add function to convert from one cgroup version to another

Add a function - cgroup_convert_cgroup() - that can convert from
one cgroup version to another.  This function will be the building
block for the libcgroup abstraction layer.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoabstraction: Add integer conversion function
Tom Hromatka [Wed, 15 Dec 2021 20:14:11 +0000 (20:14 +0000)] 
abstraction: Add integer conversion function

Add a function to the abstraction layer that can convert from
one integer setting to another.  For example, this can be used
for simple conversions like cpu.shares to cpu.weight and vice
versa.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoabstraction: Add mapping tables
Tom Hromatka [Fri, 28 Jan 2022 17:21:10 +0000 (10:21 -0700)] 
abstraction: Add mapping tables

Add a table for cgroup v1 to v2 conversions -
cgroup_v1_to_v2_map[]

Add a table for cgroup v2 to v1 conversions -
cgroup_v2_to_v1_map[]

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoabstraction: Add cgroup_strtol()
Tom Hromatka [Fri, 28 Jan 2022 17:20:38 +0000 (10:20 -0700)] 
abstraction: Add cgroup_strtol()

Add two new files, abstraction-common.[ch], and within them add
a function, cgroup_strtol(), that can convert a string to a long.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoapi.c: Remove static from cgroup_copy_controller_values()
Tom Hromatka [Wed, 15 Dec 2021 19:37:36 +0000 (19:37 +0000)] 
api.c: Remove static from cgroup_copy_controller_values()

Remove static from cgroup_copy_controller_values() in api.c
so that other files within libcgroup can invoke it.  It will
be used by the abstraction layer code in a subsequent commit.

Also, declare *dst as a const pointer and *src as a const *
const pointer.  Subsequent abstraction layer checkins make
heavy use of const and without these changes, warnings (which
continuous integration converts to errors) are thrown.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agowrapper.c: Store the version in struct cgroup_controller
Tom Hromatka [Wed, 15 Dec 2021 19:30:30 +0000 (19:30 +0000)] 
wrapper.c: Store the version in struct cgroup_controller

Store the cgroup version in struct cgroup_controller.  Each
controller can be mounted separately, and thus the cgroup
version is applicable at the controller level.

Note that this commit requires cgroup_init() to be called by
cgconfigparser.  Storing the version in the cgroup_controller
struct requires the cg_mount_table[] to be populated.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agogroups.h: Move cg_version_t to groups.h
Tom Hromatka [Wed, 15 Dec 2021 19:27:19 +0000 (19:27 +0000)] 
groups.h: Move cg_version_t to groups.h

Move cg_version_t to libcgroup/groups.h from libcgroup-internal.h.
Introduce CGROUP_DISK version to indicate the cgroup version in
sysfs.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoautomake: Don't go over 80-character lines
Tom Hromatka [Fri, 28 Jan 2022 17:17:34 +0000 (10:17 -0700)] 
automake: Don't go over 80-character lines

Nonfunctional change to line wrap lines that were 80+
characters long.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoconfigure: set version numbers for releases only
Kamalesh Babulal [Thu, 3 Feb 2022 14:59:20 +0000 (07:59 -0700)] 
configure: set version numbers for releases only

Let's set the version for releases only and set the development/main
branch version to 0.0.0, that differentiate between development and
releases.

Suggested-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #92 from drakenclimber/issues/finalize
Tom Hromatka [Wed, 2 Feb 2022 23:20:34 +0000 (16:20 -0700)] 
Merge pull request #92 from drakenclimber/issues/finalize

On some pull requests, I have observed that the coveralls summary sometimes runs before all the jobs have completed.  Let's see if this fixes it.

4 years agogithub: Always run the finalize job 92/head
Tom Hromatka [Wed, 2 Feb 2022 22:44:11 +0000 (15:44 -0700)] 
github: Always run the finalize job

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests-nocontainer: remove the skip argument
Kamalesh Babulal [Wed, 2 Feb 2022 22:13:42 +0000 (15:13 -0700)] 
ftests-nocontainer: remove the skip argument

Commit f852cad3fd64 ("ftests: Delete the cgclear functional test"),
removed the testcase 028-cgclear-basic_cgclear.py. Drop the skip
argument from the ftests-nocontainer.sh to skip the non-existing
testcase.

Suggested-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Add a test for unmappable settings
Tom Hromatka [Wed, 2 Feb 2022 17:48:10 +0000 (17:48 +0000)] 
ftests: Add a test for unmappable settings

-----------------------------------------------------------------
Test Results:
        Run Date:                          Feb 02 17:47:50
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                         Time (sec)
        ---------------------------------------
        setup                              0.00
        042-cgxget-unmappable.py           0.19
        teardown                           0.00
        ---------------------------------------
        Total Run Time                     0.19

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Add a test for the python bindings to library_version()
Tom Hromatka [Thu, 16 Dec 2021 15:06:10 +0000 (08:06 -0700)] 
ftests: Add a test for the python bindings to library_version()

Add a functional test that exercises the library_version() python
bindings.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Oct 27 15:53:49
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                         0.00
        040-pybindings-library_version.py             0.00
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                                0.00

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Add a test for the python bindings to cgroup_cgxset()
Tom Hromatka [Thu, 16 Dec 2021 15:05:42 +0000 (08:05 -0700)] 
ftests: Add a test for the python bindings to cgroup_cgxset()

Add a test for the python bindings to cgroup_cgxset()

-----------------------------------------------------------------
Test Results:
        Run Date:                          Oct 13 15:34:29
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                         0.00
        039-pybindings-cgxset.py                      0.06
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                                0.06

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agocgroup.py: Add support for cgcreate flags
Tom Hromatka [Thu, 16 Dec 2021 15:05:15 +0000 (08:05 -0700)] 
cgroup.py: Add support for cgcreate flags

Add support for all of the cgcreate flags.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Add a test for the python bindings to cgroup_cgxget()
Tom Hromatka [Thu, 16 Dec 2021 15:04:35 +0000 (08:04 -0700)] 
ftests: Add a test for the python bindings to cgroup_cgxget()

Add a functional test that exercises the cgroup_cgxget() python
bindings.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Oct 11 22:11:48
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                         0.00
        038-pybindings-cgxget.py                      0.04
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                                0.04

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Add a cgxget/cgxset test for the cpuset controller
Tom Hromatka [Thu, 16 Dec 2021 15:04:17 +0000 (08:04 -0700)] 
ftests: Add a cgxget/cgxset test for the cpuset controller

Add a functional test that exercises the cpuset v1/v2 mappings.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Sep 08 11:17:19
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                         0.00
        038-cgxget-cpuset_settings.py                 1.34
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                                1.34

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Add more cpu abstraction tests
Tom Hromatka [Thu, 16 Dec 2021 15:03:32 +0000 (08:03 -0700)] 
ftests: Add more cpu abstraction tests

Add tests for cpu.cfs_quota_us, cpu.cfs_period_us, cpu.max, and
cpu.stat to test 036-cgxget-cpu_settings.py

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Add a cgxget/cgxset test for the cpu controller
Tom Hromatka [Thu, 16 Dec 2021 14:59:44 +0000 (07:59 -0700)] 
ftests: Add a cgxget/cgxset test for the cpu controller

Add a functional test that exercises the cpu v1/v2 mappings.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Apr 19 18:39:16
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                         0.00
        037-cgxget-cpu_settings.py                    0.50
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                                0.50

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Add support for cgxset to the Cgroup class
Tom Hromatka [Thu, 16 Dec 2021 14:59:11 +0000 (07:59 -0700)] 
ftests: Add support for cgxset to the Cgroup class

Add support for cgxset to the Cgroup class

The pydoc for Cgroup.xset() is available by running:
$ python -c "from cgroup import Cgroup;help(Cgroup.xset)"

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Add support for cgxget to the Cgroup class
Tom Hromatka [Thu, 16 Dec 2021 14:58:56 +0000 (07:58 -0700)] 
ftests: Add support for cgxget to the Cgroup class

Add support for cgxget to the Cgroup class

The pydoc for Cgroup.xget() is available by running:
$ python -c "from cgroup import Cgroup;help(Cgroup.xget)"

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoapi.c: add support for cgroup.threads
Kamalesh Babulal [Thu, 27 Jan 2022 19:33:52 +0000 (12:33 -0700)] 
api.c: add support for cgroup.threads

cgroup_build_tasks_procs_path(), that builds the proc path for moving
the tid, doesn't check for the cgroup type and appends cgroup.procs for
both cgroup v1/v2.  With cgroup v2, this results in building a wrong
proc path if the cgroup type is threaded. This patch adds support to
check for the cgroup v2 type and build the proc path according to the
below table:

cgroup.type     | proc file      | Description                        |
----------------+----------------+------------------------------------+
domain          | cgroup.procs   | regular cgroup, all threads gets   |
                |                | moved to the cgroup.               |
domain threaded | cgroup.procs   | root of threaded subtree, all      |
                |                | threads gets moved to the cgroup.  |
threaded        | cgroup.threads | cgroup under threaded subtree,     |
|  | single threads with matching tid,  |
|  | gets moved to the cgroup.          |
domain invalid  | N/A            | invalid state of a cgroup under the|
                |                | threaded subtree.                  |

Closes: https://github.com/libcgroup/libcgroup/issues/64
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: add a test for cgroup v2 threaded support
Kamalesh Babulal [Tue, 25 Jan 2022 15:57:03 +0000 (15:57 +0000)] 
ftests: add a test for cgroup v2 threaded support

Add a functional test to verify threaded cgroup support on a
cgroup v2 filesystem.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Jan 25 10:41:34
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                          Time (sec)
        ----------------------------------------
        setup                               0.00
        036-cgset-multi_thread.py           0.10
        teardown                            0.00
        ----------------------------------------
        Total Run Time                      0.10

Suggested-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
TJH: Minor cleanups to utilize the new set_and_validate() method

4 years agoprocess.py: add support to spawn a multithreaded process
Kamalesh Babulal [Tue, 25 Jan 2022 15:47:27 +0000 (15:47 +0000)] 
process.py: add support to spawn a multithreaded process

Add support for creating a multithreaded process. The multithreaded
process gets created by spawning a new process, that in turn creates
N threads. The thread function is a while loop, that sleeps for N
seconds. Currently, there is no support for waiting for the threads
to join, and to stop the threads, the spawned process needs to be
terminated/killed.

Suggested-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #32 from drakenclimber/issues/validate
Tom Hromatka [Tue, 25 Jan 2022 15:09:18 +0000 (08:09 -0700)] 
Merge pull request #32 from drakenclimber/issues/validate

ENH: Refactor get/compare/fail logic

4 years agoftests: Utilize the new Cgroup validate functions
Tom Hromatka [Fri, 21 Jan 2022 22:19:30 +0000 (22:19 +0000)] 
ftests: Utilize the new Cgroup validate functions

Replace the boilerplate copy/paste code of get, compare,
and fail-on-error with calls to Cgroup.get_and_validate()
and Cgroup.set_and_validate().  This is purely a cleanup
commit and is nonfunctional.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agocgroup: Add helper methods to validate get/set
Tom Hromatka [Fri, 21 Jan 2022 22:15:35 +0000 (22:15 +0000)] 
cgroup: Add helper methods to validate get/set

Add helper methods, get_and_validate() and set_and_validate().
These methods do not map directly to any libcgroup command
line interfaces, but should be useful in reducing copy/paste
boilerplate code.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoMerge pull request #86 from drakenclimber/issues/lgtm
Tom Hromatka [Thu, 20 Jan 2022 22:26:10 +0000 (15:26 -0700)] 
Merge pull request #86 from drakenclimber/issues/lgtm

ENH: Add LGTM badge to README.md

4 years agoREADME.md: Add LGTM badge 86/head
Tom Hromatka [Wed, 12 Jan 2022 21:32:25 +0000 (14:32 -0700)] 
README.md: Add LGTM badge

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoMerge pull request #85 from drakenclimber/issues/codeql
Tom Hromatka [Wed, 19 Jan 2022 17:42:49 +0000 (10:42 -0700)] 
Merge pull request #85 from drakenclimber/issues/codeql

ENH: Add Security Features

4 years agoapi.c: Fix TOCTOU race in cgroup_get_procs() 85/head
Tom Hromatka [Wed, 19 Jan 2022 17:03:28 +0000 (10:03 -0700)] 
api.c: Fix TOCTOU race in cgroup_get_procs()

codeql flagged a potential race between the time-of-check
and time-of-use (CWE-367) of the cgroup.procs file in
cgroup_get_procs().

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agogithub: Add a code security scan
Tom Hromatka [Wed, 12 Jan 2022 19:32:22 +0000 (12:32 -0700)] 
github: Add a code security scan

Add a code security scan, CodeQL to the Github Actions
continuous integration.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoSECURITY.md: Add security file
Tom Hromatka [Wed, 12 Jan 2022 19:30:44 +0000 (12:30 -0700)] 
SECURITY.md: Add security file

Add a SECURITY.md file that outlines the process for handling
security-related vulnerabilities.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoapi.c: cache cgrules with CGFLAG_USECACHE flag
Kamalesh Babulal [Tue, 18 Jan 2022 15:22:13 +0000 (08:22 -0700)] 
api.c: cache cgrules with CGFLAG_USECACHE flag

pam_cgroup.so plugin uses /etc/cgrules.conf to assign processes
to the requested cgroup.  This works well with active
cgrulesengd but in the instances where cgrulesengd is disabled,
the rules are not read and cached by default. Fix this is by
reloading and caching the rules when called with CGFLAG_USECACHE
flag.

Fixes: https://github.com/libcgroup/libcgroup/issues/84
Reported-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
TJH: Minor commit comment changes

4 years agoMerge pull request #29 from drakenclimber/issues/ci
Tom Hromatka [Tue, 11 Jan 2022 22:17:34 +0000 (15:17 -0700)] 
Merge pull request #29 from drakenclimber/issues/ci

ENH: Add a Github Actions continuous integration workflow

4 years agoftests: Fix syntax error in container.py
Tom Hromatka [Wed, 5 Jan 2022 20:22:47 +0000 (13:22 -0700)] 
ftests: Fix syntax error in container.py

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Fix syntax errors in test 025
Tom Hromatka [Wed, 5 Jan 2022 20:22:28 +0000 (13:22 -0700)] 
ftests: Fix syntax errors in test 025

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agogithub: Add continuous integration workflow
Tom Hromatka [Wed, 5 Jan 2022 20:18:29 +0000 (13:18 -0700)] 
github: Add continuous integration workflow

Add a continuous integration workflow that runs on Github
Actions.  Enable the python syntax errors action.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #83 from drakenclimber/issues/doxygen_badge
Tom Hromatka [Mon, 3 Jan 2022 15:08:50 +0000 (08:08 -0700)] 
Merge pull request #83 from drakenclimber/issues/doxygen_badge

README.md: Add Doxygen badge

4 years agoREADME.md: Add Doxygen badge 83/head
Tom Hromatka [Mon, 20 Dec 2021 15:18:35 +0000 (08:18 -0700)] 
README.md: Add Doxygen badge

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal kamalesh.babulal@oracle.com
4 years agogithub: Move Doxygen Folder
Tom Hromatka [Fri, 17 Dec 2021 22:30:07 +0000 (15:30 -0700)] 
github: Move Doxygen Folder

After Doxygen is built, move the html folder under doc/.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #79 from drakenclimber/issues/doxygen
Tom Hromatka [Fri, 17 Dec 2021 22:19:25 +0000 (15:19 -0700)] 
Merge pull request #79 from drakenclimber/issues/doxygen

github: Add Doxyfile and github doxygen action

4 years agogithub: Add Doxyfile and github doxygen action 79/head
Tom Hromatka [Tue, 14 Dec 2021 21:50:33 +0000 (14:50 -0700)] 
github: Add Doxyfile and github doxygen action

Add a default Doxyfile and a doxygen action.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoInitialize cgroup version for named V1 hierarchy
Ingo van Lil [Thu, 16 Dec 2021 20:32:23 +0000 (13:32 -0700)] 
Initialize cgroup version for named V1 hierarchy

Commit 3aac9889 added the 'version' field in cg_mount_table_s and
initializes it in cgroup_process_v1_mnt(). The same initialization is
required in a second place dealing with named hierarchies.

Signed-off-by: Ingo van Lil <inguin@gmx.de>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #27 from drakenclimber/issues/73
Tom Hromatka [Tue, 14 Dec 2021 21:39:27 +0000 (14:39 -0700)] 
Merge pull request #27 from drakenclimber/issues/73

ftests: Add a test to get/set cgroup.type

4 years agoMerge pull request #74 from drakenclimber/issues/73
Tom Hromatka [Tue, 14 Dec 2021 21:13:07 +0000 (14:13 -0700)] 
Merge pull request #74 from drakenclimber/issues/73

api.c: Allow reading/writing from cgroup.* files in cgroup v2

4 years agoapi.c: Allow reading/writing from cgroup.* files in cgroup v2 74/head
Tom Hromatka [Mon, 6 Dec 2021 21:53:01 +0000 (14:53 -0700)] 
api.c: Allow reading/writing from cgroup.* files in cgroup v2

Allow reading/writing from cgroup.* files (such as cgroup.type
and cgroup.procs) on cgroup v2 filesystems.

Closes: https://github.com/libcgroup/libcgroup/issues/73
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
4 years agoMerge pull request #76 from drakenclimber/issues/71
Tom Hromatka [Tue, 7 Dec 2021 17:21:59 +0000 (10:21 -0700)] 
Merge pull request #76 from drakenclimber/issues/71

github: Force a fresh clone on all self-hosted runners

4 years agogithub: Force a fresh clone on all self-hosted runners 76/head
Tom Hromatka [Tue, 7 Dec 2021 16:36:51 +0000 (09:36 -0700)] 
github: Force a fresh clone on all self-hosted runners

The cgroup v2 job is being run on a self-hosted runner that
re-uses the workspace.  Delete the local workspace on all
self-hosted runners prior to cloning the repo.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #75 from drakenclimber/issues/71v2
Tom Hromatka [Tue, 7 Dec 2021 16:31:31 +0000 (09:31 -0700)] 
Merge pull request #75 from drakenclimber/issues/71v2

tests: Update submodule to the latest commit on libcgroup-tests main

4 years agotests: Update submodule to the latest commit on libcgroup-tests main branch 75/head
Tom Hromatka [Tue, 7 Dec 2021 16:14:26 +0000 (09:14 -0700)] 
tests: Update submodule to the latest commit on libcgroup-tests main branch

Closes: https://github.com/libcgroup/libcgroup/issues/71
Reported-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Add a test to get/set cgroup.type
Tom Hromatka [Mon, 6 Dec 2021 21:55:17 +0000 (14:55 -0700)] 
ftests: Add a test to get/set cgroup.type

Add a functional test that can get/set cgroup.type on a
cgroup v2 filesystem.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Dec 06 14:40:46
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                             Time (sec)
        -------------------------------------------
        setup                                  0.00
        035-cgset-set_cgroup_type.py           2.30
        teardown                               0.00
        -------------------------------------------
        Total Run Time                         2.30

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoautomake: idiomatically mark test libraries as convenience libraries
Ross Burton [Thu, 2 Dec 2021 10:51:28 +0000 (10:51 +0000)] 
automake: idiomatically mark test libraries as convenience libraries

Instead of installing then deleting, mark the libraries which are only
used at build time and should not be installed as noinst, so they don't
get installed at all.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoautomake: Don't install testing libraries
Tom Hromatka [Fri, 12 Nov 2021 13:55:20 +0000 (06:55 -0700)] 
automake: Don't install testing libraries

libcgset and libcgfortesting are libraries that are used by the
unit test framework and are not intended to be installed when
`make install` is invoked.  Delete them from the install path.

Closes: https://github.com/libcgroup/libcgroup/issues/62
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoautomake: Link libcgset with libcgroup
Tom Hromatka [Fri, 12 Nov 2021 13:51:36 +0000 (06:51 -0700)] 
automake: Link libcgset with libcgroup

When linking with the -Wl,--no-undefined flag enabled, libcgset
fails due to undefined symbols.  Fix this by enabling this flag
and linking with libcgroup.la

Closes: https://github.com/libcgroup/libcgroup/issues/66
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoREADME: fix typos across the file
Kamalesh Babulal [Mon, 1 Nov 2021 20:26:45 +0000 (14:26 -0600)] 
README: fix typos across the file

Fix a couple of typos across the file.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agocgclassify: fix error message
Kamalesh Babulal [Mon, 1 Nov 2021 20:26:12 +0000 (14:26 -0600)] 
cgclassify: fix error message

Fix the typo in the error message, while trying to parse the cgroup to
place the task.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests.py: fix test results timing alignment
Kamalesh Babulal [Thu, 28 Oct 2021 20:25:09 +0000 (14:25 -0600)] 
ftests.py: fix test results timing alignment

The current width length of 35 characters, used as alignment for the
first column in the timing results of ftests.sh.log is not enough and
results in misaligned output. Fix it by assigning the columns format
strings width to the longest filename, calculated just before executing
every testcase. This avoids adjusting the width every time, with newer
testcases. Also, fix the banner separator lines to match the width of
the filename column + 15 (time), dynamically.

without the patch:
```
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                        96.39
        001-cgget-basic_cgget_v1.py                   1.36
        002-cgdelete-recursive_delete.py              4.07
        003-cgget-basic_cgget_v2.py                   0.00
        004-cgsnapshot-basic_snapshot_v1.py           9.41
        005-cgsnapshot-basic_snapshot_v2.py           0.00
        006-cgrules-basic_cgrules_v1.py               0.00
        007-cgrules-basic_cgrules_v2.py               0.00
        008-cgget-multiple_r_flags.py                 1.80
        009-cgget-g_flag_controller_only.py           1.03
        010-cgget-g_flag_controller_and_cgroup.py           1.10
        011-cgget-r_flag_two_cgroups.py               2.34
        012-cgget-multiple_r_flags2.py                3.27
        013-cgget-multiple_g_flags.py                 1.74
        014-cgget-a_flag.py                           1.65
        015-cgget-multiline_r_flag.py                 0.99
        016-cgget-invalid_options.py                  3.30
        017-cgconfig-load_file.py                     1.78
        018-cgconfig-load_dir.py                      2.83
        019-cgconfig-uidgid_dperm_fperm.py            3.40
        020-cgconfig-tasks_perms_owner.py             7.26
        021-cgconfig-invalid_options.py               0.75
        022-cgset-multiple_r_flag.py                  2.21
        023-cgset-copy_from.py                        3.27
        025-cgset-multiple_cgroups.py                 3.14
        026-cgset-multiple_r_multiple_cgroup.py           3.80
        027-cgset-invalid_options.py                  6.42
        029-lssubsys-basic_lssubsys.py                3.60
        030-lssubsys-lssubsys_all.py                  0.72
        031-lscgroup-g_flag.py                        1.81
        032-lscgroup-multiple_g_flags.py              3.20
        033-cgget-no_flags.py                         1.12
        034-cgexec-basic_cgexec.py                    2.49
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                              176.24
PASS ftests.sh (exit status: 0)
```

with the patch:
```
Timing Results:
        Test                                          Time (sec)
        --------------------------------------------------------
        setup                                              95.12
        001-cgget-basic_cgget_v1.py                         1.50
        002-cgdelete-recursive_delete.py                    4.31
        003-cgget-basic_cgget_v2.py                         0.00
        004-cgsnapshot-basic_snapshot_v1.py                 2.68
        005-cgsnapshot-basic_snapshot_v2.py                 0.00
        006-cgrules-basic_cgrules_v1.py                     0.00
        007-cgrules-basic_cgrules_v2.py                     0.00
        008-cgget-multiple_r_flags.py                       1.89
        009-cgget-g_flag_controller_only.py                 1.30
        010-cgget-g_flag_controller_and_cgroup.py           1.20
        011-cgget-r_flag_two_cgroups.py                     6.31
        012-cgget-multiple_r_flags2.py                      3.49
        013-cgget-multiple_g_flags.py                       1.82
        014-cgget-a_flag.py                                 2.36
        015-cgget-multiline_r_flag.py                       1.07
        016-cgget-invalid_options.py                        3.45
        017-cgconfig-load_file.py                           2.58
        018-cgconfig-load_dir.py                            3.08
        019-cgconfig-uidgid_dperm_fperm.py                  3.88
        020-cgconfig-tasks_perms_owner.py                  10.46
        021-cgconfig-invalid_options.py                     0.78
        022-cgset-multiple_r_flag.py                        2.33
        023-cgset-copy_from.py                              3.50
        025-cgset-multiple_cgroups.py                       3.90
        026-cgset-multiple_r_multiple_cgroup.py             4.75
        027-cgset-invalid_options.py                        8.52
        029-lssubsys-basic_lssubsys.py                      1.68
        030-lssubsys-lssubsys_all.py                        0.81
        031-lscgroup-g_flag.py                              2.10
        032-lscgroup-multiple_g_flags.py                    3.49
        033-cgget-no_flags.py                               1.28
        034-cgexec-basic_cgexec.py                          3.21
        teardown                                            0.00
        --------------------------------------------------------
        Total Run Time                                    182.86
PASS ftests.sh (exit status: 0)
```

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Reviewed-by: Dhaval Giani <dhaval.giani@gmail.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: testcase 013 - remove debug statements
Kamalesh Babulal [Thu, 21 Oct 2021 21:28:45 +0000 (15:28 -0600)] 
ftests: testcase 013 - remove debug statements

Remove the debugging statements that print the return values
(result, cause) from testcase 013-cgget-multiple_g_flags.py.
These values show up in ftests.sh.log, otherwise, and might
lead to confusion on how to interpret them.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agogithub: re-arrange workflow run commands
Kamalesh Babulal [Thu, 21 Oct 2021 21:18:28 +0000 (15:18 -0600)] 
github: re-arrange workflow run commands

The current workflow executes the functional tests from the make check
called at the top-level source directory. Though this runs the tests
case, it also has an unintended side effect of re-running gunit tests
for every functional test combination in the workflow. Fix it, by
re-arranging the function test run commands, to change into
tests/ftests directory before executing make check.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoconfigure.ac: check for the library containing fts_open
Ross Burton [Fri, 10 Sep 2021 17:24:47 +0000 (11:24 -0600)] 
configure.ac: check for the library containing fts_open

The musl C library doesn't provide fts.h[1], so libcgroup doesn't
compile with musl. However, there is a standalone implementation of fts
for musl users[2] which can be used.

Use AC_SEARCH_LIBS to search for fts_open, which will check if it is part
of libc, and if not look in libfts, then set LIBS if needed.

[1] https://wiki.musl-libc.org/faq.html
[2] https://github.com/void-linux/musl-fts

Closes #61.

Signed-off-by: Ross Burton <ross.burton@arm.com>
[TJH: minor formatting changes to match existing configure.ac]
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #59 from drakenclimber/issues/mainbadge
Tom Hromatka [Wed, 21 Jul 2021 15:50:41 +0000 (09:50 -0600)] 
Merge pull request #59 from drakenclimber/issues/mainbadge

README.md: Display status of main branch in build status badge

4 years agoREADME.md: Display status of main branch in build status badge 59/head
Tom Hromatka [Wed, 21 Jul 2021 15:40:45 +0000 (09:40 -0600)] 
README.md: Display status of main branch in build status badge

The master branch was renamed to main, but the build status
badge wasn't updated as part of this change.  Display the
build status of the main branch in README.md

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #57 from drakenclimber/issues/fixmerge
Tom Hromatka [Tue, 6 Jul 2021 20:47:45 +0000 (14:47 -0600)] 
Merge pull request #57 from drakenclimber/issues/fixmerge

github: Fix merge collision in v1/v2 code coverage

4 years agogithub: Fix merge collision in v1/v2 code coverage 57/head
Tom Hromatka [Tue, 6 Jul 2021 20:37:23 +0000 (14:37 -0600)] 
github: Fix merge collision in v1/v2 code coverage

Fix merge collision in the gathering of the v1/v2
code coverage metrics.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #56 from drakenclimber/issues/improvecodecov
Tom Hromatka [Tue, 6 Jul 2021 20:08:13 +0000 (14:08 -0600)] 
Merge pull request #56 from drakenclimber/issues/improvecodecov

github: Improve code coverage collection

4 years agogithub: Improve code coverage collection 56/head
Tom Hromatka [Tue, 6 Jul 2021 19:26:34 +0000 (13:26 -0600)] 
github: Improve code coverage collection

Improve code coverage collection by utilizing the "-i" flag
prior to the run.  This allows coverage on #ifdef'ed code.

Also, archive the code coverage files for later analysis if
desired.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #54 from drakenclimber/issues/removetestsdir
Tom Hromatka [Tue, 6 Jul 2021 15:45:37 +0000 (09:45 -0600)] 
Merge pull request #54 from drakenclimber/issues/removetestsdir

github: Delete the tests folder before bootstrap

4 years agogithub: Delete the tests folder before bootstrap 54/head
Tom Hromatka [Tue, 6 Jul 2021 15:16:09 +0000 (09:16 -0600)] 
github: Delete the tests folder before bootstrap

On self-hosted github machines, the working directory for
libcgroup is reused from one run to the next.  This is fine
for the root of the directory as the proper git clean/reset
commands are issues.  But this is problematic for the git
submodules like the tests/ folder because clean/reset is nott
run there.

Remove the tests/ directory entirely and rely on ./bootstrap.sh
to recreate and populate it.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #53 from drakenclimber/pull/45
Tom Hromatka [Tue, 6 Jul 2021 15:13:17 +0000 (09:13 -0600)] 
Merge pull request #53 from drakenclimber/pull/45

Replace __BEGIN_DECLS and __END_DECLS with extern "C".

4 years agoReplace __BEGIN_DECLS and __END_DECLS with extern "C". 53/head
Anthony G. Basile [Tue, 6 Jul 2021 13:54:47 +0000 (07:54 -0600)] 
Replace __BEGIN_DECLS and __END_DECLS with extern "C".

The macros __BEGIN_DECLS and __END_DECLS are a GNU-ism found in
glibc and uClibc, but not musl.  We replace them by the more general
extern "C" { ... } block exposed only if we have __cplusplus.

Forward ported from a patch by Anthony G. Basile <blueness@gentoo.org>.

Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #52 from drakenclimber/issues/cgv2-tests
Tom Hromatka [Mon, 21 Jun 2021 21:38:48 +0000 (15:38 -0600)] 
Merge pull request #52 from drakenclimber/issues/cgv2-tests

github: Add self-hosted runner

4 years agogithub: Add self-hosted runner 52/head
Tom Hromatka [Wed, 2 Jun 2021 21:07:29 +0000 (21:07 +0000)] 
github: Add self-hosted runner

Add a self-hosted runner to test full v2 functionality

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #24 from drakenclimber/issues/cgv2-tests
Tom Hromatka [Mon, 21 Jun 2021 20:55:11 +0000 (14:55 -0600)] 
Merge pull request #24 from drakenclimber/issues/cgv2-tests

Add support for full cgroup v2 systems

4 years agoMerge pull request #51 from drakenclimber/issues/contributing
Tom Hromatka [Wed, 9 Jun 2021 17:17:26 +0000 (11:17 -0600)] 
Merge pull request #51 from drakenclimber/issues/contributing

docs: Add CONTRIBUTING.md

4 years agodocs: Add CONTRIBUTING.md 51/head
Tom Hromatka [Mon, 24 May 2021 14:55:16 +0000 (08:55 -0600)] 
docs: Add CONTRIBUTING.md

Add a document that outlines the steps to contribute to
libcgroup.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Skip test 032 due to Github Issue #50
Tom Hromatka [Wed, 2 Jun 2021 19:46:48 +0000 (19:46 +0000)] 
ftests: Skip test 032 due to Github Issue #50

On full cgroup v2 systems, skip 032-lscgroup-multiple_g_flags.py
due to Github Issue #50.  Currently lscgroup is doing path matching
on the mounts that have the same path as the cgroup rather than
reading cgroup.controllers for that particular cgroup.  I'm afraid
fixing it could involve a non-trivial rewrite of lscgroup since it
doesn't use any of the common structures used elsewhere in libcgroup.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Skip test 031 due to Github Issue #50
Tom Hromatka [Wed, 2 Jun 2021 20:37:21 +0000 (20:37 +0000)] 
ftests: Skip test 031 due to Github Issue #50

On full cgroup v2 systems, skip 031-lscgroup-g_flag.py
due to Github Issue #50.  Currently lscgroup is doing path matching
on the mounts that have the same path as the cgroup rather than
reading cgroup.controllers for that particular cgroup.  I'm afraid
fixing it could involve a non-trivial rewrite of lscgroup since it
doesn't use any of the common structures used elsewhere in libcgroup.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Modify functional test 030 to support cgroup v2
Tom Hromatka [Wed, 2 Jun 2021 20:11:01 +0000 (20:11 +0000)] 
ftests: Modify functional test 030 to support cgroup v2

Add cgroup v2 support to the 030-lssubsys-lssubsys_all.py
functional test.  It continues to support cgroup v1 as well.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Modify functional test 014 to support cgroup v2
Tom Hromatka [Wed, 2 Jun 2021 13:34:33 +0000 (13:34 +0000)] 
ftests: Modify functional test 014 to support cgroup v2

Add support for a full cgroup v2 system to the 014-cgget-a_flag.py
functional test.  It continues to support cgroup v1 as well.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Modify functional test 013 to support cgroup v2
Tom Hromatka [Wed, 2 Jun 2021 20:38:42 +0000 (20:38 +0000)] 
ftests: Modify functional test 013 to support cgroup v2

Add cgroup v2 support to the 013-cgget-multiple_g_flags.py
functional test.  It continues to support cgroup v1 as well.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agocgroup.py: Fix bug in delete with multiple controllers
Tom Hromatka [Wed, 2 Jun 2021 13:33:14 +0000 (13:33 +0000)] 
cgroup.py: Fix bug in delete with multiple controllers

When multiple controllers are passed into Cgroup.delete()
via a list, delete() was erroneously joining them without
a comma separator.  Add the comma separator.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Modify functional test 012 to support cgroup v2
Tom Hromatka [Wed, 2 Jun 2021 13:48:51 +0000 (13:48 +0000)] 
ftests: Modify functional test 012 to support cgroup v2

Add cgroup v2 support to the 012-cgget-multiple_r_flags2.py
functional test.  It continues to support cgroup v1 as well.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Modify functional test 011 to support cgroup v2
Tom Hromatka [Wed, 2 Jun 2021 14:33:06 +0000 (14:33 +0000)] 
ftests: Modify functional test 011 to support cgroup v2

Add cgroup v2 support to the 011-cgget-r_flag_two_cgroups.py
functional test.  It continues to support cgroup v1 as well.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Modify functional test 010 to support cgroup v2
Tom Hromatka [Wed, 2 Jun 2021 13:10:02 +0000 (13:10 +0000)] 
ftests: Modify functional test 010 to support cgroup v2

Add cgroup v2 support to the 010-cgget-g_flag_controller_and_cgroup.py
functional test.  It continues to support cgroup v1 as well.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Modify functional test 009 to support cgroup v2
Tom Hromatka [Wed, 2 Jun 2021 19:58:24 +0000 (19:58 +0000)] 
ftests: Modify functional test 009 to support cgroup v2

Add cgroup v2 support to the 009-cgget-g_flag_controller_only.py
functional test.  It continues to support cgroup v1 as well.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Modify functional test 008 to support cgroup v2
Tom Hromatka [Tue, 1 Jun 2021 22:10:12 +0000 (22:10 +0000)] 
ftests: Modify functional test 008 to support cgroup v2

Add cgroup v2 support to the 008-cgget-multiple_r_flags.py
functional test.  It continues to support cgroup v1 as well.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Modify functional test 005 to support cgroup v2
Tom Hromatka [Wed, 2 Jun 2021 13:58:53 +0000 (13:58 +0000)] 
ftests: Modify functional test 005 to support cgroup v2

Add support for a full cgroup v2 system to the
005-cgsnapshot-basic_snapshot_v2.py functional test. It
continues to support cgroup v1 systems and mixed systems
as well.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agorun.py: Ignore LXD cgroup v2 warning
Tom Hromatka [Tue, 1 Jun 2021 22:08:13 +0000 (22:08 +0000)] 
run.py: Ignore LXD cgroup v2 warning

On full cgroup v2 systems, LXD raises the following warning:
WARNING: cgroup v2 is not fully supported yet

Add logic to run.py to ignore this warning.  A non-zero return
code or other strings in stderr should still cause a RunError
exception to be raised.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #49 from drakenclimber/issues/delete-cgclear
Tom Hromatka [Tue, 1 Jun 2021 18:46:54 +0000 (12:46 -0600)] 
Merge pull request #49 from drakenclimber/issues/delete-cgclear

cgclear: Delete cgclear