]> git.proxmox.com Git - pve-guest-common.git/commitdiff
fix #4572: config: also update volume IDs in pending section
authorFiona Ebner <f.ebner@proxmox.com>
Wed, 15 Mar 2023 14:44:22 +0000 (15:44 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 16 Mar 2023 09:27:44 +0000 (10:27 +0100)
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@proxmox.com>
src/PVE/AbstractConfig.pm

index a0c0bc673178500e86b262d0fe52a929530bea84..d393081b2624e3b91146f940eceb6926ed370f44 100644 (file)
@@ -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.