[PATCH FOLLOW-UP qemu-server 1/1] api2: move_disk: use parse_volname to find old volume format

Alexandre Derumier alexandre.derumier at groupe-cyllene.com
Tue Jul 15 07:27:36 CEST 2025


Signed-off-by: Alexandre Derumier <alexandre.derumier at groupe-cyllene.com>
---
 src/PVE/API2/Qemu.pm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
index 2e6358e4..dbc08737 100644
--- a/src/PVE/API2/Qemu.pm
+++ b/src/PVE/API2/Qemu.pm
@@ -4677,11 +4677,8 @@ __PACKAGE__->register_method({
             die "you can't move a cdrom\n" if PVE::QemuServer::drive_is_cdrom($drive, 1);
 
             my $old_volid = $drive->{file};
-            my $oldfmt;
             my ($oldstoreid, $oldvolname) = PVE::Storage::parse_volume_id($old_volid);
-            if ($oldvolname =~ m/\.(raw|qcow2|vmdk)$/) {
-                $oldfmt = $1;
-            }
+            my $oldfmt = (PVE::Storage::parse_volname($storecfg, $old_volid))[6];
 
             die "you can't move to the same storage with same format\n"
                 if $oldstoreid eq $storeid && (!$format || !$oldfmt || $oldfmt eq $format);
-- 
2.39.5




More information about the pve-devel mailing list