From c788e7c8d1e3b75570231642865d538277b87e22 Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Wed, 15 Mar 2023 15:44:22 +0100 Subject: [PATCH] fix #4572: config: also update volume IDs in pending section 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 --- 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.39.5