[pve-devel] [PATCH RFC 1/3] Resources: add new flag 'start'

Dietmar Maurer dietmar at proxmox.com
Mon Nov 14 12:23:57 CET 2016


without any functionality for now.

Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 src/PVE/HA/Config.pm          |  1 +
 src/PVE/HA/Resources.pm       | 11 ++++++++++-
 src/PVE/HA/Resources/PVECT.pm |  1 +
 src/PVE/HA/Resources/PVEVM.pm |  1 +
 src/PVE/HA/Sim/Hardware.pm    |  3 ++-
 5 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/PVE/HA/Config.pm b/src/PVE/HA/Config.pm
index 1802a7d..552cb1a 100644
--- a/src/PVE/HA/Config.pm
+++ b/src/PVE/HA/Config.pm
@@ -98,6 +98,7 @@ sub read_and_check_resources_config {
 	$d->{state} = 'enabled' if !defined($d->{state});
 	$d->{max_restart} = 1 if !defined($d->{max_restart});
 	$d->{max_relocate} = 1 if !defined($d->{max_relocate});
+	$d->{start} = 1 if !defined($d->{start});
 	if (PVE::HA::Resources->lookup($d->{type})) {
 	    if (my $vmd = $vmlist->{ids}->{$name}) {
 		if (!$vmd) {
diff --git a/src/PVE/HA/Resources.pm b/src/PVE/HA/Resources.pm
index 96d2f8f..5556ee4 100644
--- a/src/PVE/HA/Resources.pm
+++ b/src/PVE/HA/Resources.pm
@@ -40,7 +40,16 @@ my $defaultData = {
 	    optional => 1,
 	    default => 1,
 	    minimum => 0,
-	},
+        },
+	start => {
+	    type => 'boolean',
+	    optional => 1,
+	    default => 0,
+	    description => "Flag for marking a resource as not able to " .
+		"start. This can be useful for Templates or also other " .
+		"resources which should be recovered on failure but not " .
+		"touched otherwise.",
+        },
 	comment => {
 	    description => "Description.",
 	    type => 'string',
diff --git a/src/PVE/HA/Resources/PVECT.pm b/src/PVE/HA/Resources/PVECT.pm
index d1312ab..0fb8c9a 100644
--- a/src/PVE/HA/Resources/PVECT.pm
+++ b/src/PVE/HA/Resources/PVECT.pm
@@ -29,6 +29,7 @@ sub options {
 	comment => { optional => 1 },
 	max_restart => { optional => 1 },
 	max_relocate => { optional => 1 },
+	start => { optional => 1 },
     };
 }
 
diff --git a/src/PVE/HA/Resources/PVEVM.pm b/src/PVE/HA/Resources/PVEVM.pm
index 55d4368..7414544 100644
--- a/src/PVE/HA/Resources/PVEVM.pm
+++ b/src/PVE/HA/Resources/PVEVM.pm
@@ -28,6 +28,7 @@ sub options {
 	comment => { optional => 1 },
 	max_restart => { optional => 1 },
 	max_relocate => { optional => 1 },
+	start => { optional => 1 },
     };
 }
 
diff --git a/src/PVE/HA/Sim/Hardware.pm b/src/PVE/HA/Sim/Hardware.pm
index 383b10e..a722495 100644
--- a/src/PVE/HA/Sim/Hardware.pm
+++ b/src/PVE/HA/Sim/Hardware.pm
@@ -100,9 +100,10 @@ sub read_service_config {
 	} else {
 	    die "implement me";
 	}
-	$d->{state} = 'disabled' if !$d->{state};
+	$d->{state} = 'disabled' if !defined($d->{state});
 	$d->{max_restart} = 1 if !defined($d->{max_restart});
 	$d->{max_relocate} = 1 if !defined($d->{max_relocate});
+	$d->{start} = 1 if !defined($d->{start});
     }
 
     return $conf;
-- 
2.1.4




More information about the pve-devel mailing list