[pve-devel] [PATCH ha-manager 2/6] replace service_config_exists with has_services

Dietmar Maurer dietmar at proxmox.com
Tue Feb 9 11:03:00 CET 2016


applied modified, see inline comment:

> diff --git a/src/PVE/HA/Tools.pm b/src/PVE/HA/Tools.pm
> index 2814453..b9bf842 100644
> --- a/src/PVE/HA/Tools.pm
> +++ b/src/PVE/HA/Tools.pm
> @@ -146,6 +146,23 @@ sub write_json_to_file {
>      PVE::Tools::file_set_contents($filename, $raw);
>  }
>  
> +sub has_services {
> +    my ($haenv, $node) = @_;
> +
> +    return undef if !PVE::HA::Config::resources_config_exists();

removed above line.

> +
> +    my $conf = $haenv->read_service_config();
> +
> +    # if no node defined any service count is fine
> +    return scalar(%{$conf}) if !$node;
> +
> +    foreach my $d (values %$conf) {
> +	return 1 if $d->{node} eq $node;
> +    }
> +
> +    return undef;
> +}
> +
>  sub count_fenced_services {
>      my ($ss, $node) = @_;
>  




More information about the pve-devel mailing list