[pve-devel] [PATCH cluster 1/1] datacenter config: add cluster resource scheduling (crs) options
Fiona Ebner
f.ebner at proxmox.com
Thu Nov 10 15:37:48 CET 2022
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 at proxmox.com>
---
data/PVE/DataCenterConfig.pm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/data/PVE/DataCenterConfig.pm b/data/PVE/DataCenterConfig.pm
index 6a2adee..fcc9684 100644
--- a/data/PVE/DataCenterConfig.pm
+++ b/data/PVE/DataCenterConfig.pm
@@ -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,
@@ -135,6 +147,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',
@@ -280,6 +297,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);
}
@@ -332,6 +353,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);
}
--
2.30.2
More information about the pve-devel
mailing list