* [pve-devel] [PATCH manager] cluster resources: add cgroup-mode to node properties
@ 2021-07-07 8:52 Fabian Ebner
0 siblings, 0 replies; only message in thread
From: Fabian Ebner @ 2021-07-07 8:52 UTC (permalink / raw)
To: pve-devel
so the frontend has the information readily available.
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
PVE/API2/Cluster.pm | 12 ++++++++++++
PVE/Service/pvestatd.pm | 11 +++++++++++
2 files changed, 23 insertions(+)
diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm
index 3b918e55..11d6aa3a 100644
--- a/PVE/API2/Cluster.pm
+++ b/PVE/API2/Cluster.pm
@@ -306,6 +306,11 @@ __PACKAGE__->register_method({
type => 'string',
optional => 1,
},
+ 'cgroup-mode' => {
+ description => "The cgroup mode the node operates under (when type == node).",
+ type => 'integer',
+ optional => 1,
+ },
},
},
},
@@ -410,10 +415,17 @@ __PACKAGE__->register_method({
}
}
+ my $cgroup_modes = PVE::Cluster::get_node_kv("cgroup-mode");
+
if (!$param->{type} || $param->{type} eq 'node') {
foreach my $node (@$nodelist) {
my $can_audit = $rpcenv->check($authuser, "/nodes/$node", [ 'Sys.Audit' ], 1);
my $entry = PVE::API2Tools::extract_node_stats($node, $members, $rrd, !$can_audit);
+
+ if (defined(my $mode = $cgroup_modes->{$node})) {
+ $entry->{'cgroup-mode'} = int($mode);
+ }
+
push @$res, $entry;
}
}
diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm
index 7193388c..22173d63 100755
--- a/PVE/Service/pvestatd.pm
+++ b/PVE/Service/pvestatd.pm
@@ -122,6 +122,15 @@ my $generate_rrd_string = sub {
return join(':', map { $_ // 'U' } @$data);
};
+my $broadcast_cgroup_mode = sub {
+ my $cgroup_mode = eval { PVE::CGroup::cgroup_mode(); };
+ if (my $err = $@) {
+ syslog('err', "cgroup mode error: $err");
+ }
+
+ PVE::Cluster::broadcast_node_kv("cgroup-mode", $cgroup_mode);
+};
+
sub update_node_status {
my ($status_cfg) = @_;
@@ -151,6 +160,8 @@ sub update_node_status {
# everything not free is considered to be used
my $dused = $dinfo->{blocks} - $dinfo->{bfree};
+ $broadcast_cgroup_mode->();
+
my $ctime = time();
my $data = $generate_rrd_string->(
--
2.30.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-07 8:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 8:52 [pve-devel] [PATCH manager] cluster resources: add cgroup-mode to node properties Fabian Ebner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal