[pve-devel] [PATCH ha-manager] Resource/API: abort early if resource in error state

Dietmar Maurer dietmar at proxmox.com
Wed Nov 30 06:21:16 CET 2016


comments inline:

> diff --git a/src/PVE/API2/HA/Resources.pm b/src/PVE/API2/HA/Resources.pm
> index 621c9e6..f1fac54 100644
> --- a/src/PVE/API2/HA/Resources.pm
> +++ b/src/PVE/API2/HA/Resources.pm
> @@ -187,6 +187,14 @@ __PACKAGE__->register_method ({
>  		if !$group_cfg->{ids}->{$group};
>  	}
>  
> +	my $service_status = PVE::HA::Config::get_service_status($sid);
> +	if ($service_status->{state} eq 'error' &&
> +	    !(defined($param->{state}) && $param->{state} eq 'disabled')) {
> +	    # service in error state, must be disabled first before new state
> +	    # request can be executed
> +	    die "service '$sid' in error state, must be disabled and fixed first\n";
> +	}

IMHO it is perfectly valid to edit a resource while it is in error state, so 
I do not really think this is helpful.


>  	PVE::HA::Config::lock_ha_domain(
>  	    sub {
>  
> @@ -288,6 +296,11 @@ __PACKAGE__->register_method ({
>  
>  	PVE::HA::Config::service_is_ha_managed($sid);
>  
> +	my $service_status = PVE::HA::Config::get_service_status($sid);
> +	if ($service_status->{state} eq 'error') {
> +	    die "service '$sid' in error state, must be disabled and fixed first\n";
> +	}
> +
>  	PVE::HA::Config::queue_crm_commands("migrate $sid $param->{node}");


Would it make sense to move that check into queue_crm_commands() ?




More information about the pve-devel mailing list