[pve-devel] [RFC v2 2/3] Fixed hardcoded type 'vm' in check if vm is ha managed
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue Sep 1 14:01:52 CEST 2015
The new approach checks every registered resource type.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
src/PVE/HA/Config.pm | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/PVE/HA/Config.pm b/src/PVE/HA/Config.pm
index 58f5b58..a9913da 100644
--- a/src/PVE/HA/Config.pm
+++ b/src/PVE/HA/Config.pm
@@ -14,6 +14,7 @@ PVE::HA::Groups->register();
PVE::HA::Groups->init();
PVE::HA::Resources::PVEVM->register();
+PVE::HA::Resources::PVECT->register();
#PVE::HA::Resources::IPAddr->register();
PVE::HA::Resources->init();
@@ -161,9 +162,14 @@ sub vm_is_ha_managed {
my $conf = cfs_read_file($ha_resources_config);
- my $sid = "vm:$vmid";
-
- return defined($conf->{ids}->{$sid});
+ my $types = PVE::HA::Resources->lookup_types();
+ foreach my $type (@$types) {
+ my $sid = "$type:$vmid";
+
+ return 1 if defined($conf->{ids}->{$sid});
+}
+
+ return undef;
}
1;
--
2.1.4
More information about the pve-devel
mailing list