]> git.proxmox.com Git - pve-cluster.git/commitdiff
pvecm: qdevice setup: fix check for odd node count
authorAaron Lauterer <a.lauterer@proxmox.com>
Tue, 24 Mar 2020 16:16:42 +0000 (17:16 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 25 Mar 2020 08:45:00 +0000 (09:45 +0100)
With Perl 5.26 the behavior of `scalar(%hash)` changed [0] causing the
check for odd numbers to never evaluate to true. Allowing odd sized
clusters to set up a QDevice. The algorithm was not changed to LMS if
forced to still create the QDevice.

Instead of showing the bucket info of the referenced hash it did show
the hash reference. Dereferencing it will again return the number of
items present in the hash.

[0] https://perldoc.perl.org/perl5260delta.html#scalar(%25hash)-return-signature-changed

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
data/PVE/CLI/pvecm.pm

index a36c2bdfba6de13dafde51414582569692d50782..a558813bd6e8cd89388fb329d204b5fa3f63692a 100755 (executable)
@@ -126,7 +126,7 @@ __PACKAGE__->register_method ({
 
        my $model = "net";
        my $algorithm = 'ffsplit';
-       if (scalar($members) & 1) {
+       if (scalar(%{$members}) & 1) {
            if ($param->{force}) {
                $algorithm = 'lms';
            } else {