[pve-devel] [PATCH qemu-server] api: clone: sort vm disks to keep numbers consistent

Lorenz Stechauner l.stechauner at proxmox.com
Wed May 26 16:19:17 CEST 2021


reported by user in forum:
https://forum.proxmox.com/threads/problem-when-copying-template-with-2-discs.89851/

Signed-off-by: Lorenz Stechauner <l.stechauner at proxmox.com>
---
 PVE/API2/Qemu.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index c56b609..24dba86 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -3157,7 +3157,7 @@ __PACKAGE__->register_method({
 		    my $total_jobs = scalar(keys %{$drives});
 		    my $i = 1;
 
-		    foreach my $opt (keys %$drives) {
+		    foreach my $opt (sort keys %$drives) {
 			my $drive = $drives->{$opt};
 			my $skipcomplete = ($total_jobs != $i); # finish after last drive
 			my $completion = $skipcomplete ? 'skip' : 'complete';
-- 
2.20.1





More information about the pve-devel mailing list