[pve-devel] [PATCH cluster] datacenter.cfg: add ha setting with shutdown_policy as format string property

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Dec 19 12:42:29 CET 2018


mostly spelling/grammer/phrasing, see inline

On Wed, Dec 19, 2018 at 11:39:38AM +0100, Thomas Lamprecht wrote:
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
>  data/PVE/Cluster.pm | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
> index f4dd1a3..e6421e7 100644
> --- a/data/PVE/Cluster.pm
> +++ b/data/PVE/Cluster.pm
> @@ -1337,6 +1337,17 @@ my $migration_format = {
>      },
>  };
>  
> +my $ha_format = {
> +    shutdown_policy => {
> +	type => 'string',
> +	enum => ['freeze', 'failover', 'default'],

s/default/auto/ ? seems more appropriate ;)

> +	description => "The policy for HA services on node shutdown. With freeze services will never get auto recovered. Failover ensures the service can get recovered. Default recovers on poweroff but does not on reboot.",

The policy for HA services on node shutdown. 'freeze' disables
auto-recovery, 'failover' ensures recovery, 'auto' recovers on poweroff
and freezes on reboot.

> +	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 manager. Failover will not mark the services a frozen and thus the services will get recovered to other nodes, if the shutdown node does not comes up again fast (< 2min). Default is dependent of the type of shutdown, i.e., on a reboot the service will be freezed but on a poweroff the service nill stay as is, and thus recovered after about 2 minutes.",

s/manager/HA manager/
s/a frozen/as frozen/
s/does not comes/does not come/
s/up again fast/up again quickly/ (fast = speed, quick = time ;))
s/is dependent of/chooses automatically depending on/
s/freezed/frozen/
s/nill/will
s/thus recovered/thus get recovered/

> +	default => 'default',

s/'default'/'auto'/ (iff above ;))
> +    }
> +};
> +
> +
>  my $datacenter_schema = {
>      type => "object",
>      additionalProperties => 0,
> @@ -1420,6 +1431,11 @@ my $datacenter_schema = {
>  	      " With both all two modes are used." .
>  	      "\n\nWARNING: 'hardware' and 'both' are EXPERIMENTAL & WIP",
>  	},
> +	ha => {
> +	    optional => 1,
> +	    type => 'string', format => $ha_format,
> +	    description => "Cluster wide HA settings.",
> +	},
>  	mac_prefix => {
>  	    optional => 1,
>  	    type => 'string',
> @@ -1442,6 +1458,10 @@ sub parse_datacenter_config {
>  	$res->{migration} = PVE::JSONSchema::parse_property_string($migration_format, $migration);
>      }
>  
> +    if (my $ha = $res->{ha}) {
> +	$res->{ha} = PVE::JSONSchema::parse_property_string($ha_format, $ha);
> +    }
> +
>      # for backwards compatibility only, new migration property has precedence
>      if (defined($res->{migration_unsecure})) {
>  	if (defined($res->{migration}->{type})) {
> @@ -1478,6 +1498,10 @@ sub write_datacenter_config {
>  	$cfg->{migration} = PVE::JSONSchema::print_property_string($migration, $migration_format);
>      }
>  
> +    if (my $ha = $cfg->{ha}) {
> +	$cfg->{ha} = PVE::JSONSchema::print_property_string($ha, $ha_format);
> +    }
> +
>      return PVE::JSONSchema::dump_config($datacenter_schema, $filename, $cfg);
>  }
>  
> -- 
> 2.19.2
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list