public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH cluster 1/1] datacenter config: turn shutdown policy into a standard option
Date: Fri, 16 Jun 2023 13:33:37 +0200	[thread overview]
Message-ID: <20230616113345.65996-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20230616113345.65996-1-f.ebner@proxmox.com>

to be re-used by the node/status API endpoint.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 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





  reply	other threads:[~2023-06-16 11:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-16 11:33 [pve-devel] [PATCH-SERIES cluster/(ha-)manager] allow node HA shutdown policy override Fiona Ebner
2023-06-16 11:33 ` Fiona Ebner [this message]
2023-06-16 12:47   ` [pve-devel] applied: [PATCH cluster 1/1] datacenter config: turn shutdown policy into a standard option Thomas Lamprecht
2023-06-16 11:33 ` [pve-devel] [PATCH ha-manager 1/7] lrm service: add runtime directory Fiona Ebner
2023-06-16 11:33 ` [pve-devel] [RFC ha-manager 2/7] lrm service: move PID file to service's " Fiona Ebner
2023-06-16 11:33 ` [pve-devel] [PATCH ha-manager 3/7] pve2 env: get shutdown policy override set by node's shutdown API endpoint Fiona Ebner
2023-06-16 11:33 ` [pve-devel] [PATCH ha-manager 4/7] lrm: honor " Fiona Ebner
2023-06-16 11:33 ` [pve-devel] [RFC ha-manager 5/7] pve2 env: validate shutdown policy from override file Fiona Ebner
2023-06-16 11:33 ` [pve-devel] [PATCH ha-manager 6/7] sim env: add support for datacenter config overrides Fiona Ebner
2023-06-16 11:33 ` [pve-devel] [PATCH ha-manager 7/7] tests: add test for shutdown policy override Fiona Ebner
2023-06-16 11:33 ` [pve-devel] [PATCH manager 1/1] api: nodes: allow setting HA shutdown policy during shutdown/reboot Fiona Ebner
2023-06-20  8:35   ` Fabian Grünbichler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230616113345.65996-2-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal