[pve-devel] [PATCH v2 manager 5/8] order guest IDs numerically in exec_backup

Fabian Ebner f.ebner at proxmox.com
Thu Oct 22 12:30:14 CEST 2020


The assumption that they already are sorted is no longer valid,
because of the IDs for non-existent guests.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

Should also be more future-proof to do it locally.

This could be squashed into either the previous or
the following patch.

 PVE/VZDump.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 7ff32ce2..e1c26b42 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -1072,7 +1072,8 @@ sub exec_backup {
     }
 
     my $vmlist = PVE::Cluster::get_vmlist();
-    foreach my $vmid (@{$opts->{vmids}}) {
+    my $vmids = [ sort { $a <=> $b } @{$opts->{vmids}} ];
+    foreach my $vmid (@{$vmids}) {
 	my $plugin;
 	if (defined($vmlist->{ids}->{$vmid})) {
 	    my $guest_type = $vmlist->{ids}->{$vmid}->{type};
-- 
2.20.1






More information about the pve-devel mailing list