[pve-devel] [PATCH guest-common] fix #4572: config: also update volume IDs in pending section

Fiona Ebner f.ebner at proxmox.com
Wed Mar 15 15:44:22 CET 2023


The method is intended to be used in cases where the volumes actually
got renamed (e.g. migration). Thus, updating the volume IDs should of
course also be done for pending changes to avoid changes referring to
now non-existent volumes or even the wrong existing volume.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 src/PVE/AbstractConfig.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PVE/AbstractConfig.pm b/src/PVE/AbstractConfig.pm
index a0c0bc6..d393081 100644
--- a/src/PVE/AbstractConfig.pm
+++ b/src/PVE/AbstractConfig.pm
@@ -485,8 +485,8 @@ sub foreach_volume {
 }
 
 # $volume_map is a hash of 'old_volid' => 'new_volid' pairs.
-# This method replaces 'old_volid' by 'new_volid' throughout
-# the config including snapshots and unused and vmstate volumes
+# This method replaces 'old_volid' by 'new_volid' throughout the config including snapshots, pending
+# changes, unused volumes and vmstate volumes.
 sub update_volume_ids {
     my ($class, $conf, $volume_map) = @_;
 
@@ -512,6 +512,8 @@ sub update_volume_ids {
 	my $snap_conf = $conf->{snapshots}->{$snap};
 	$class->foreach_volume_full($snap_conf, $opts, $do_replace, $snap_conf);
     }
+
+    $class->foreach_volume_full($conf->{pending}, $opts, $do_replace, $conf->{pending});
 }
 
 # Returns whether the template parameter is set in $conf.
-- 
2.30.2






More information about the pve-devel mailing list