[pve-devel] [PATCH pve-manager 2/2] Fix check if vm is ha managed in get_start_stop_list

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Oct 19 18:02:47 CEST 2015


The check used was completely wrong and so the startall and stopall
API calls touched HA managed service, which they shouldn't.

Using the vm_is_ha_managed call from the HA stack fixes that.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 PVE/API2/Nodes.pm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 8a8a7c1..41baca0 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -1132,7 +1132,6 @@ __PACKAGE__->register_method({
 my $get_start_stop_list = sub {
     my ($nodename, $autostart) = @_;
 
-    my $haconf = PVE::HA::Config::read_resources_config();
     my $vmlist = PVE::Cluster::get_vmlist();
 
     my $resList = {};
@@ -1164,8 +1163,8 @@ my $get_start_stop_list = sub {
 	    }
 
 	    # skip ha managed VMs (started by pve-ha-manager)
-	    return if defined($haconf->{ids}->{"pvevm:$vmid"});
-	    
+	    return if PVE::HA::Config::vm_is_ha_managed($vmid);
+
 	    $resList->{$startup->{order}}->{$vmid} = $startup;
 	    $resList->{$startup->{order}}->{$vmid}->{type} = $d->{type};
 	};
-- 
2.1.4





More information about the pve-devel mailing list