[pve-devel] [PATCH ha-manager 3/6] Env/PVE2: get_node_info: ensure quorate and actual info is used

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Nov 7 15:27:10 CET 2017


Do not trust member information if not quorate and if quorate ensure
member information is up do date.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/HA/Env/PVE2.pm | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm
index 8baf2d0..2db56af 100644
--- a/src/PVE/HA/Env/PVE2.pm
+++ b/src/PVE/HA/Env/PVE2.pm
@@ -177,17 +177,19 @@ sub get_node_info {
 
     my ($node_info, $quorate) = ({}, 0);
 
+    if (PVE::Cluster::check_cfs_quorum(1)) {
+	$quorate = 1;
+
+	PVE::Cluster::cfs_update();
+	my $members = PVE::Cluster::get_members();
+
+	foreach my $node (keys %$members) {
+	    my $d = $members->{$node};
+	    $node_info->{$node}->{online} = $d->{online};
+	}
+    }
+
     my $nodename = $self->{nodename};
-
-    $quorate = PVE::Cluster::check_cfs_quorum(1) || 0;
-
-    my $members = PVE::Cluster::get_members();
-
-    foreach my $node (keys %$members) {
-	my $d = $members->{$node};
-	$node_info->{$node}->{online} = $d->{online};
-    }
-
     $node_info->{$nodename}->{online} = 1; # local node is always up
 
     return ($node_info, $quorate);
-- 
2.11.0





More information about the pve-devel mailing list