[pve-devel] [PATCH ha-manager] Resources: deny setting nonexistent group

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Apr 20 13:04:54 CEST 2016


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/API2/HA/Resources.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/PVE/API2/HA/Resources.pm b/src/PVE/API2/HA/Resources.pm
index 5fa970e..621c9e6 100644
--- a/src/PVE/API2/HA/Resources.pm
+++ b/src/PVE/API2/HA/Resources.pm
@@ -180,6 +180,13 @@ __PACKAGE__->register_method ({
 	    die "types does not match\n" if $param_type ne $type;
 	}
 
+	if (my $group = $param->{group}) {
+	    my $group_cfg = PVE::HA::Config::read_group_config();
+
+	    die "HA group '$group' does not exist\n"
+		if !$group_cfg->{ids}->{$group};
+	}
+
 	PVE::HA::Config::lock_ha_domain(
 	    sub {
 
-- 
2.1.4





More information about the pve-devel mailing list