[pve-devel] [PATCH container] apply_pending: call cleanup_pending between change/delete loops

Oguz Bektas o.bektas at proxmox.com
Wed Feb 5 15:03:29 CET 2020


instead of calling it while iterating, inbetween the loops is a better
place in terms of similarity with qemu side (also this should fix the bug that
dominik found[0])

[0]: https://pve.proxmox.com/pipermail/pve-devel/2020-February/041573.html

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

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 310aba6..e88ba0b 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1268,7 +1268,6 @@ sub vmconfig_apply_pending {
     # FIXME: $force deletion is not implemented for CTs
     foreach my $opt (sort keys %$pending_delete_hash) {
 	next if $selection && !$selection->{$opt};
-	$class->cleanup_pending($conf);
 	eval {
 	    if ($opt =~ m/^mp(\d+)$/) {
 		my $mp = $class->parse_ct_mountpoint($conf->{$opt});
@@ -1289,6 +1288,8 @@ sub vmconfig_apply_pending {
 	}
     }
 
+    $class->cleanup_pending($conf);
+
     foreach my $opt (sort keys %{$conf->{pending}}) { # add/change
 	next if $opt eq 'delete'; # just to be sure
 	next if $selection && !$selection->{$opt};
@@ -1304,7 +1305,6 @@ sub vmconfig_apply_pending {
 	if (my $err = $@) {
 	    $add_apply_error->($opt, $err);
 	} else {
-	    $class->cleanup_pending($conf);
 	    $conf->{$opt} = delete $conf->{pending}->{$opt};
 	}
     }
-- 
2.20.1




More information about the pve-devel mailing list