From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id BEFAAA1DF0 for ; Fri, 16 Jun 2023 13:33:54 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A01A5321B7 for ; Fri, 16 Jun 2023 13:33:54 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 16 Jun 2023 13:33:49 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 78BF345B11 for ; Fri, 16 Jun 2023 13:33:49 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Fri, 16 Jun 2023 13:33:37 +0200 Message-Id: <20230616113345.65996-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230616113345.65996-1-f.ebner@proxmox.com> References: <20230616113345.65996-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.047 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH cluster 1/1] datacenter config: turn shutdown policy into a standard option X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2023 11:33:54 -0000 to be re-used by the node/status API endpoint. Signed-off-by: Fiona Ebner --- src/PVE/DataCenterConfig.pm | 50 +++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/src/PVE/DataCenterConfig.pm b/src/PVE/DataCenterConfig.pm index 5f12450..3d24e78 100644 --- a/src/PVE/DataCenterConfig.pm +++ b/src/PVE/DataCenterConfig.pm @@ -3,7 +3,7 @@ package PVE::DataCenterConfig; use strict; use warnings; -use PVE::JSONSchema qw(parse_property_string); +use PVE::JSONSchema qw(get_standard_option parse_property_string register_standard_option); use PVE::Tools; use PVE::Cluster; @@ -59,30 +59,32 @@ my $notification_format = { }, }; +register_standard_option('pve-ha-shutdown-policy', { + type => 'string', + enum => ['freeze', 'failover', 'conditional', 'migrate'], + description => "The policy for HA services on node shutdown. 'freeze' disables ". + "auto-recovery, 'failover' ensures recovery, 'conditional' recovers on ". + "poweroff and freezes on reboot. 'migrate' will migrate running services ". + "to other nodes, if possible. With 'freeze' or 'failover', HA Services will ". + "always get stopped first on shutdown.", + verbose_description => "Describes the policy for handling HA services on poweroff ". + "or reboot of a node. Freeze will always freeze services which are still located ". + "on the node on shutdown, those services won't be recovered by the HA manager. ". + "Failover will not mark the services as frozen and thus the services will get ". + "recovered to other nodes, if the shutdown node does not come up again quickly ". + "(< 1min). 'conditional' chooses automatically depending on the type of shutdown, ". + "i.e., on a reboot the service will be frozen but on a poweroff the service will ". + "stay as is, and thus get recovered after about 2 minutes. ". + "Migrate will try to move all running services to another node when a reboot or ". + "shutdown was triggered. The poweroff process will only continue once no running services ". + "are located on the node anymore. If the node comes up again, the service will ". + "be moved back to the previously powered-off node, at least if no other migration, ". + "reloaction or recovery took place.", + default => 'conditional', +}); + my $ha_format = { - shutdown_policy => { - type => 'string', - enum => ['freeze', 'failover', 'conditional', 'migrate'], - description => "The policy for HA services on node shutdown. 'freeze' disables ". - "auto-recovery, 'failover' ensures recovery, 'conditional' recovers on ". - "poweroff and freezes on reboot. 'migrate' will migrate running services ". - "to other nodes, if possible. With 'freeze' or 'failover', HA Services will ". - "always get stopped first on shutdown.", - verbose_description => "Describes the policy for handling HA services on poweroff ". - "or reboot of a node. Freeze will always freeze services which are still located ". - "on the node on shutdown, those services won't be recovered by the HA manager. ". - "Failover will not mark the services as frozen and thus the services will get ". - "recovered to other nodes, if the shutdown node does not come up again quickly ". - "(< 1min). 'conditional' chooses automatically depending on the type of shutdown, ". - "i.e., on a reboot the service will be frozen but on a poweroff the service will ". - "stay as is, and thus get recovered after about 2 minutes. ". - "Migrate will try to move all running services to another node when a reboot or ". - "shutdown was triggered. The poweroff process will only continue once no running services ". - "are located on the node anymore. If the node comes up again, the service will ". - "be moved back to the previously powered-off node, at least if no other migration, ". - "reloaction or recovery took place.", - default => 'conditional', - } + shutdown_policy => get_standard_option('pve-ha-shutdown-policy'), }; my $next_id_format = { -- 2.39.2