[pve-devel] applied: [PATCH ha-manager] fix #1602: allow to delete 'ignored' services over API
Wolfgang Bumiller
w.bumiller at proxmox.com
Fri Jan 25 09:34:08 CET 2019
applied
On Wed, Jan 23, 2019 at 10:34:40AM +0100, Thomas Lamprecht wrote:
> service_is_ha_managed returns false if a service is in the resource
> configuration but marked as 'ignore', as for the internal stack it is
> as it wasn't HA managed at all.
>
> But user should be able to remvoe it from the configuration easily
> even in this state, without setting the requesttate to anything else
> first.
>
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
> src/PVE/API2/HA/Resources.pm | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/PVE/API2/HA/Resources.pm b/src/PVE/API2/HA/Resources.pm
> index 10acedf..0fd631a 100644
> --- a/src/PVE/API2/HA/Resources.pm
> +++ b/src/PVE/API2/HA/Resources.pm
> @@ -296,12 +296,18 @@ __PACKAGE__->register_method ({
>
> my ($sid, $type, $name) = PVE::HA::Config::parse_sid(extract_param($param, 'sid'));
>
> - PVE::HA::Config::service_is_ha_managed($sid);
> + my $cfg = PVE::HA::Config::read_resources_config();
> +
> + # cannot use service_is_ha_managed as it ignores 'ignored' services,
> + # see bug report #1602
> + if (!defined($cfg->{ids}) || !defined($cfg->{ids}->{$sid})) {
> + die "cannot delete service '$sid', not HA managed!\n";
> + }
>
> PVE::HA::Config::lock_ha_domain(
> sub {
>
> - my $cfg = PVE::HA::Config::read_resources_config();
> + $cfg = PVE::HA::Config::read_resources_config();
>
> delete $cfg->{ids}->{$sid};
>
> --
> 2.20.1
More information about the pve-devel
mailing list