[pve-devel] [PATCH container] iterate pending config changes sorted

Oguz Bektas o.bektas at proxmox.com
Wed Oct 23 18:48:27 CEST 2019


since we sort them while going through the delete hash, we can do it for
the other loops for consistency.

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 src/PVE/LXC/Config.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index b744d4f..87c6883 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -930,7 +930,7 @@ sub update_pct_config {
 	    if !$storage_config->{content}->{rootdir};
     };
 
-    foreach my $opt (keys %$param) { # add/change
+    foreach my $opt (sort keys %$param) { # add/change
 	$modified->{$opt} = 1;
 	my $value = $param->{$opt};
 	if ($opt =~ m/^mp(\d+)$/ || $opt eq 'rootfs') {
@@ -1120,7 +1120,7 @@ sub vmconfig_hotplug_pending {
     };
 
     my $changes;
-    foreach my $opt (keys %{$conf->{pending}}) { # add/change
+    foreach my $opt (sort keys %{$conf->{pending}}) { # add/change
 	next if $selection && !$selection->{$opt};
 	if ($LXC_FASTPLUG_OPTIONS->{$opt}) {
 	    $conf->{$opt} = delete $conf->{pending}->{$opt};
@@ -1196,7 +1196,7 @@ sub vmconfig_hotplug_pending {
 	}
     }
 
-    foreach my $opt (keys %{$conf->{pending}}) {
+    foreach my $opt (sort keys %{$conf->{pending}}) {
 	next if $opt eq 'delete'; # just to be sure
 	next if $selection && !$selection->{$opt};
 	my $value = $conf->{pending}->{$opt};
@@ -1273,7 +1273,7 @@ sub vmconfig_apply_pending {
 	}
     }
 
-    foreach my $opt (keys %{$conf->{pending}}) { # add/change
+    foreach my $opt (sort keys %{$conf->{pending}}) { # add/change
 	next if $opt eq 'delete'; # just to be sure
 	next if $selection && !$selection->{$opt};
 	eval {
-- 
2.20.1




More information about the pve-devel mailing list