[pve-devel] [PATCH ha-manager v2] Config: add get_service_status method

Dietmar Maurer dietmar at proxmox.com
Mon Apr 18 16:45:59 CEST 2016



> On April 18, 2016 at 4:31 PM Thomas Lamprecht <t.lamprecht at proxmox.com> wrote:
> 
> 
> ---
> 
> changes since v1:
> * only read resource configuration file once
> * s/cfg/conf/ to match coding style of package better
> 
>  src/PVE/HA/Config.pm | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/src/PVE/HA/Config.pm b/src/PVE/HA/Config.pm
> index f7440c0..a152e1c 100644
> --- a/src/PVE/HA/Config.pm
> +++ b/src/PVE/HA/Config.pm
> @@ -192,4 +192,25 @@ sub service_is_ha_managed {
>  
>      return undef;
>  }
> +
> +sub get_service_status {
> +    my ($sid) = @_;
> +
> +    my $status = { managed => 0 };
> +
> +    my $conf = cfs_read_file($ha_resources_config);

you call cfs_read_file here

> +
> +    if (&$servive_check_ha_state($conf, $sid)) {
> +	my $sc = $conf->{ids}->{$sid};
> +
> +	my $manager_status = read_manager_status();

but here you call the wrapper? Why not 

my $manager_status = cfs_read_file($manager_status_filename);




More information about the pve-devel mailing list