[pve-devel] [PATCH v2 container 3/5] cgroup: more generic get_cgroup_controllers function
Wolfgang Bumiller
w.bumiller at proxmox.com
Tue Apr 14 09:30:18 CEST 2020
On Thu, Apr 09, 2020 at 01:28:37PM +0200, Wolfgang Bumiller wrote:
> Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
> ---
> Changes to v1:
> * Add a convenience method for querying a set of multiple possible
> controllers.
>
> src/PVE/LXC.pm | 14 +----
> src/PVE/LXC/CGroup.pm | 139 ++++++++++++++++++++++++++++++++++--------
> 2 files changed, 116 insertions(+), 37 deletions(-)
>
> diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
> index 914dc2a..711ddd9 100644
> --- a/src/PVE/LXC.pm
> +++ b/src/PVE/LXC.pm
> @@ -401,19 +401,9 @@ sub parse_ipv4_cidr {
> die "unable to parse ipv4 address/mask\n";
> }
>
> +# Deprecated. Use `PVE::LXC::CGroup::get_cgroup_controllers()` instead.
> sub get_cgroup_subsystems {
> - my $v1 = {};
> - my $v2 = 0;
> - my $data = PVE::Tools::file_get_contents('/proc/self/cgroup');
> - while ($data =~ /^\d+:([^:\n]*):.*$/gm) {
> - my $type = $1;
> - if (length($type)) {
> - $v1->{$_} = 1 foreach split(/,/, $type);
> - } else {
> - $v2 = 1;
> - }
> - }
> - return wantarray ? ($v1, $v2) : $v1;
> + PVE::LXC::Cgroup::get_v1_controllers();
^ This should be a captail 'G' here, CGroup.
More information about the pve-devel
mailing list