X-Git-Url: https://git.proxmox.com/?p=pve-access-control.git;a=blobdiff_plain;f=PVE%2FRPCEnvironment.pm;h=f65a776134b271a8d6b0c8e3fd5c1e8280997280;hp=a0c0c3328f2313ce0f73d1e453808ea6b4f968ee;hb=be6ea72391199dda073615881ddda229bc94ff92;hpb=7b24102dc59e233d65b5982a7d9070bdbaaf7979 diff --git a/PVE/RPCEnvironment.pm b/PVE/RPCEnvironment.pm index a0c0c33..f65a776 100644 --- a/PVE/RPCEnvironment.pm +++ b/PVE/RPCEnvironment.pm @@ -180,7 +180,7 @@ sub init { die "already initialized" if $pve_env; - die "unknown environment type" if !$type || $type !~ m/^(cli|pub|priv)$/; + die "unknown environment type" if !$type || $type !~ m/^(cli|pub|priv|ha)$/; $SIG{CHLD} = $worker_reaper; @@ -188,6 +188,7 @@ sub init { # cli ... command started fron command line # pub ... access from public server (apache) # priv ... access from private server (pvedaemon) + # ha ... access from HA resource manager agent (rgmanager) my $self = { user_cfg => {}, @@ -276,6 +277,8 @@ sub init_request { PVE::Cluster::cfs_update(); + $self->{result_attributes} = {}; + my $userconfig; # we use this for regression tests foreach my $p (keys %params) { if ($p eq 'userconfig') { @@ -324,16 +327,16 @@ sub get_client_ip { return $self->{client_ip}; } -sub set_result_count { - my ($self, $count) = @_; +sub set_result_attrib { + my ($self, $key, $value) = @_; - $self->{result_count} = $count; + $self->{result_attributes}->{$key} = $value; } -sub get_result_count { - my ($self) = @_; +sub get_result_attrib { + my ($self, $key) = @_; - return $self->{result_count}; + return $self->{result_attributes}->{$key}; } sub set_language { @@ -637,6 +640,9 @@ sub fork_worker { POSIX::read($csync[0], $readbuf, 4096); die "parent setup error\n" if $readbuf ne 'OK'; + if ($self->{type} eq 'ha') { + print "task started by HA resource agent\n"; + } eval { &$function($upid); }; my $err = $@; if ($err) {