]> git.proxmox.com Git - pve-cluster.git/commitdiff
datacenter config: add cluster resource scheduling (crs) options
authorFiona Ebner <f.ebner@proxmox.com>
Thu, 10 Nov 2022 14:37:48 +0000 (15:37 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 17 Nov 2022 11:48:59 +0000 (12:48 +0100)
Initially, with a setting for HA to switch between basic (just count
services) and static (use static node and resource information).

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
data/PVE/DataCenterConfig.pm

index f72974eba93a097f997d527014935f4c93aad227..5a707224b0afccc6f7c3f81f871b1cf53f40863b 100644 (file)
@@ -7,6 +7,18 @@ use PVE::JSONSchema qw(parse_property_string);
 use PVE::Tools;
 use PVE::Cluster;
 
+my $crs_format = {
+    ha => {
+       type => 'string',
+       enum => ['basic', 'static'],
+       description => "Use this resource scheduler mode for HA.",
+       default => 'basic',
+       verbose_description => "Configures how the HA manager should select nodes to start or ".
+           "recover services. With 'basic', only the number of services is used, with 'static', ".
+           "static CPU and memory configuration of services is considered.",
+    },
+};
+
 my $migration_format = {
     type => {
        default_key => 1,
@@ -191,6 +203,11 @@ my $datacenter_schema = {
     type => "object",
     additionalProperties => 0,
     properties => {
+       crs => {
+           optional => 1,
+           type => 'string', format => $crs_format,
+           description => "Cluster resource scheduling settings.",
+       },
        keyboard => {
            optional => 1,
            type => 'string',
@@ -356,6 +373,10 @@ sub parse_datacenter_config {
 
     $res->{description} = $comment;
 
+    if (my $crs = $res->{crs}) {
+       $res->{crs} = parse_property_string($crs_format, $crs);
+    }
+
     if (my $migration = $res->{migration}) {
        $res->{migration} = parse_property_string($migration_format, $migration);
     }
@@ -425,6 +446,10 @@ sub write_datacenter_config {
        $cfg->{console} = 'html5';
     }
 
+    if (ref(my $crs = $cfg->{crs})) {
+       $cfg->{crs} = PVE::JSONSchema::print_property_string($crs, $crs_format);
+    }
+
     if (ref(my $migration = $cfg->{migration})) {
        $cfg->{migration} = PVE::JSONSchema::print_property_string($migration, $migration_format);
     }