[pve-devel] [PATCH cluster] pvecm: qdevice setup: fix check for odd node count
Aaron Lauterer
a.lauterer at proxmox.com
Tue Mar 24 17:16:42 CET 2020
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 at proxmox.com>
---
@Thomas feel free to correct the commit message should my explanation not be
accurate.
data/PVE/CLI/pvecm.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm
index a36c2bd..a558813 100755
--- a/data/PVE/CLI/pvecm.pm
+++ b/data/PVE/CLI/pvecm.pm
@@ -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 {
--
2.20.1
More information about the pve-devel
mailing list