[pve-devel] [PATCH manager] backup: fix #2913 order jobs numerically by VMID

Aaron Lauterer a.lauterer at proxmox.com
Tue Aug 4 11:46:38 CEST 2020


At this point, the VMIDs are already numerically sorted by the
PVE::VZDump::check_vmids method. Calling another sort on the array,
especially without `{$a <=> $b}`, resulted in reordering the array
alphabetically.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
 PVE/VZDump.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index f80faeff..88437bd7 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -1048,7 +1048,7 @@ sub exec_backup {
     }
 
     my $vmlist = PVE::Cluster::get_vmlist();
-    foreach my $vmid (sort @{$opts->{vmids}}) {
+    foreach my $vmid (@{$opts->{vmids}}) {
 	my $guest_type = $vmlist->{ids}->{$vmid}->{type};
 	my $plugin = $vzdump_plugins->{$guest_type};
 	next if !$rpcenv->check($authuser, "/vms/$vmid", [ 'VM.Backup' ], $opts->{all});
-- 
2.20.1





More information about the pve-devel mailing list