From 576032a269e61251f83854f28a77a07d5d972c3d Mon Sep 17 00:00:00 2001 From: Meliox Date: Tue, 9 Jun 2026 23:02:46 +0200 Subject: [PATCH] fix rrd history patch for compilation --- .../patches/02-nodes-pm-GPU-RRD-history.patch | 59 ++----------------- 1 file changed, 4 insertions(+), 55 deletions(-) diff --git a/src/PVENodeInfo/patches/02-nodes-pm-GPU-RRD-history.patch b/src/PVENodeInfo/patches/02-nodes-pm-GPU-RRD-history.patch index cad2a6a..141ae72 100644 --- a/src/PVENodeInfo/patches/02-nodes-pm-GPU-RRD-history.patch +++ b/src/PVENodeInfo/patches/02-nodes-pm-GPU-RRD-history.patch @@ -8,60 +8,11 @@ { name => 'scan' }, { name => 'sdn' }, { name => 'services' }, -@@ -878,6 +879,108 @@ +@@ -878,6 +879,57 @@ "pve-node-9.0/$param->{node}", $param->{timeframe}, $param->{cf}, ); }, -+ -+__PACKAGE__->register_method({ -+ name => 'gpurrddata', -+ path => 'gpurrddata', -+ method => 'GET', -+ protected => 1, -+ proxyto => 'node', -+ permissions => { -+ check => ['perm', '/nodes/{node}', ['Sys.Audit']], -+ }, -+ description => "Read GPU RRD statistics", -+ parameters => { -+ additionalProperties => 0, -+ properties => { -+ node => get_standard_option('pve-node'), -+ card => { -+ description => "The GPU card identifier (e.g. card0, nvidia0).", -+ type => 'string', -+ pattern => '[a-zA-Z0-9]+', -+ }, -+ timeframe => { -+ description => "Specify the time frame you are interested in.", -+ type => 'string', -+ enum => ['hour', 'day', 'week', 'month', 'year', 'decade'], -+ }, -+ cf => { -+ description => "The RRD consolidation function", -+ type => 'string', -+ enum => ['AVERAGE', 'MAX'], -+ optional => 1, -+ }, -+ }, -+ }, -+ returns => { -+ type => "array", -+ items => { -+ type => "object", -+ properties => {}, -+ }, -+ }, -+ code => sub { -+ my ($param) = @_; -+ my $nodename = PVE::INotify::nodename(); -+ my $card = $param->{card}; -+ die "invalid card name -+" unless $card =~ /^[a-zA-Z0-9]+$/; -+ return PVE::RRD::create_rrd_data( -+ "pve-mod-gpu/$nodename/$card", $param->{timeframe}, $param->{cf}, -+ ); -+ }, +-}); +}); + +__PACKAGE__->register_method({ @@ -107,13 +58,11 @@ + my ($param) = @_; + my $nodename = PVE::INotify::nodename(); + my $card = $param->{card}; -+ die "invalid card name -+" unless $card =~ /^[a-zA-Z0-9]+$/; ++ die "invalid card name\n" unless $card =~ /^[a-zA-Z0-9]+$/; + return PVE::RRD::create_rrd_data( + "pve-mod-gpu/$nodename/$card", $param->{timeframe}, $param->{cf}, + ); + }, +}); - }); - __PACKAGE__->register_method({ + __PACKAGE__->register_method({ \ No newline at end of file