public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH guest-common] fix #4572: config: also update volume IDs in pending section
Date: Wed, 15 Mar 2023 15:44:22 +0100	[thread overview]
Message-ID: <20230315144422.139303-1-f.ebner@proxmox.com> (raw)

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 | 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





             reply	other threads:[~2023-03-15 14:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 14:44 Fiona Ebner [this message]
2023-03-16 10:53 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230315144422.139303-1-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal