Else we the regression test produce a indeterministic output.
As the hashs would else be traversed in random order it makes no
real difference for the PVE2 environment, so just sort keys when we
add them to the cluster or spawn resource agent workers to avoid
that problem.

Signed-off-by: Thomas Lamprecht <t.lampre...@proxmox.com>
---
 src/PVE/HA/LRM.pm     | 2 +-
 src/PVE/HA/Manager.pm | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/HA/LRM.pm b/src/PVE/HA/LRM.pm
index a49410f..26c5c89 100644
--- a/src/PVE/HA/LRM.pm
+++ b/src/PVE/HA/LRM.pm
@@ -376,7 +376,7 @@ sub run_workers {
     while (($haenv->get_time() - $starttime) < 5) {
        my $count =  $self->check_active_workers();
 
-       foreach my $sid (keys %{$self->{workers}}) {
+       foreach my $sid (sort keys %{$self->{workers}}) {
            last if $count >= $max_workers && $max_workers > 0;
 
            my $w = $self->{workers}->{$sid};
diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
index 622ece8..1208720 100644
--- a/src/PVE/HA/Manager.pm
+++ b/src/PVE/HA/Manager.pm
@@ -360,7 +360,7 @@ sub manage {
        
        $self->recompute_online_node_usage();
 
-       foreach my $sid (keys %$ss) {
+       foreach my $sid (sort keys %$ss) {
            my $sd = $ss->{$sid};
            my $cd = $sc->{$sid} || { state => 'disabled' };
 
-- 
2.1.4


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to