Skip to content

Release 0.3.0: native cgroup v2 API and v1 compatibility fixes - #15

Merged
rjcloudsigma merged 3 commits into
masterfrom
modernization/0.3.0
Oct 29, 2026
Merged

rjcloudsigma merged 3 commits into
masterfrom
modernization/0.3.0

Conversation

@rjcloudsigma

@rjcloudsigma rjcloudsigma commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Adds an explicit, read-only-by-default cgroup v2 API with native CPU, memory, cpuset, pids and I/O controls, namespace-aware mount discovery, delegated writes and partial-command error reporting. Existing v1 APIs, value types, units, constructor defaults and Python 2.7/3.6+ compatibility remain; unsafe or malformed commands are intentionally rejected.

Repairs v1 device-rule validation, per-record kernel writes, throttle filenames, I/O parsing, subgroup construction, controller aliases and current libvirt thread layouts. Includes native API/upgrade guides, a 0.3.0 changelog, versioned installation instructions, universal wheels and source archives containing runnable tests.

Validation: all 134 tests pass on Python 2.7 and 3.6–3.15. Linux integration verifies actual v2 CPU throttling, resource commands, effective masks, freeze events, complete/partial process migrations and v1 tasks/procs commands in an isolated named hierarchy. Source/wheel builds, strict metadata checks, source-archive tests, legacy installation of the release wheel, and CodeQL checks pass. Runtime statement coverage is 92% in the local Python 3.14 run.

CI: https://github.com/cloudsigma/cgroupspy/actions/runs/40935087079

Turlo's private GitLab deployment remains unverified and unchanged. Its production pin needs downstream contract tests before rollout. GitHub release assets are prepared; PyPI publishing credentials are unavailable.

Comment on lines +85 to +86
'import sys,time; sys.stdin.read(1); end=time.process_time()+0.2\n'
'while time.process_time()<end: pass'], stdin=subprocess.PIPE)
Comment thread cgroupspy/v2.py
"""Use openat, or Linux procfs for the retained Python 2.7 runtime."""
flags |= getattr(os, 'O_CLOEXEC', 0) | getattr(os, 'O_NOFOLLOW', 0)
if os.open in getattr(os, 'supports_dir_fd', ()):
return _cloexec(os.open(name, flags, dir_fd=directory))
Comment thread cgroupspy/v2.py
flags |= getattr(os, 'O_CLOEXEC', 0) | getattr(os, 'O_NOFOLLOW', 0)
if os.open in getattr(os, 'supports_dir_fd', ()):
return _cloexec(os.open(name, flags, dir_fd=directory))
return _cloexec(os.open('/proc/self/fd/{}/{}'.format(directory, name), flags))
Comment thread cgroupspy/v2.py
self._root_fd = None
flags = os.O_RDONLY | getattr(os, 'O_DIRECTORY', 0)
flags |= getattr(os, 'O_CLOEXEC', 0) | getattr(os, 'O_NOFOLLOW', 0)
self._root_fd = _cloexec(os.open(self.root_path, flags))
Comment thread cgroupspy/trees.py
path = normalize_tree_path(path)
return [node for node in self.walk() if node.path == path]

def get_node_by_raw_path(self, path):
Comment thread cgroupspy/v2.py
def __del__(self):
try:
self.close()
except Exception:
self.assertRaises(ValueError, str, rule)

def test_contenttype_equality_handles_other_objects(self):
self.assertFalse(DeviceAccess('c', 1, 3) == object())

def test_contenttype_equality_handles_other_objects(self):
self.assertFalse(DeviceAccess('c', 1, 3) == object())
self.assertFalse(DeviceThrottle(10, 8, 0) == object())
Comment on lines +18 to +21
from ..interfaces import (BaseFileInterface, BatchWriteError, CommaDashSetFile,
DictFile, DictOrFlagFile, IntegerFile, IntegerListFile,
ListFile, MultiLineIntegerFile, OomControlFile,
SplitValueFile, TypedFile)
@rjcloudsigma
rjcloudsigma marked this pull request as ready for review October 29, 2026 18:55
@rjcloudsigma
rjcloudsigma merged commit 2ba3c1a into master Oct 29, 2026
16 checks passed
@rjcloudsigma
rjcloudsigma deleted the modernization/0.3.0 branch October 31, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant