public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH guest-common] fix #4572: config: also update volume IDs in pending section
@ 2023-03-15 14:44 Fiona Ebner
  2023-03-16 10:53 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2023-03-15 14:44 UTC (permalink / raw)
  To: pve-devel

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH guest-common] fix #4572: config: also update volume IDs in pending section
  2023-03-15 14:44 [pve-devel] [PATCH guest-common] fix #4572: config: also update volume IDs in pending section Fiona Ebner
@ 2023-03-16 10:53 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2023-03-16 10:53 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fiona Ebner

Am 15/03/2023 um 15:44 schrieb Fiona Ebner:
> 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(-)
> 
>

applied, thanks!

as talked off-list, I wrapped this and the pre-existing $conf->{snapshot} access
into an if-defined guard, just to be sure as autovivifiaction and undef-warns can
be both a nuisance.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-16 10:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 14:44 [pve-devel] [PATCH guest-common] fix #4572: config: also update volume IDs in pending section Fiona Ebner
2023-03-16 10:53 ` [pve-devel] applied: " Thomas Lamprecht

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