From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id DC53D1FF16B for ; Tue, 29 Jul 2025 13:17:16 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 59A85EF11; Tue, 29 Jul 2025 13:16:42 +0200 (CEST) From: Wolfgang Bumiller To: pve-devel@lists.proxmox.com Date: Tue, 29 Jul 2025 13:15:31 +0200 Message-ID: <20250729111557.136012-19-w.bumiller@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250729111557.136012-1-w.bumiller@proxmox.com> References: <20250729111557.136012-1-w.bumiller@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1753787749956 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.078 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH storage 18/26] plugins: update create_base methods X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Signed-off-by: Wolfgang Bumiller --- src/PVE/Storage/BTRFSPlugin.pm | 12 ++++++++++-- src/PVE/Storage/Plugin.pm | 9 +++++++-- src/PVE/Storage/RBDPlugin.pm | 6 +++++- src/PVE/Storage/ZFSPlugin.pm | 6 +++++- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/PVE/Storage/BTRFSPlugin.pm b/src/PVE/Storage/BTRFSPlugin.pm index 0a42c88..b3a53b0 100644 --- a/src/PVE/Storage/BTRFSPlugin.pm +++ b/src/PVE/Storage/BTRFSPlugin.pm @@ -260,7 +260,11 @@ sub create_base { $class->parse_volname($volname); my $newname = $name; - $newname =~ s/^vm-/base-/; + if ($newname =~ /^vm-/) { + $newname =~ s/^vm-/base-/; + } else { + $newname = "base-$newname"; + } # If we're not working with a 'raw' file, which is the only thing that's "different" for btrfs, # or a subvolume, we forward to the DirPlugin @@ -441,7 +445,11 @@ sub free_image { my ($vtype, undef, $vmid, undef, undef, undef, $format) = $class->parse_volname($volname); - if (!defined($format) || $vtype ne 'images' || ($format ne 'subvol' && $format ne 'raw')) { + if ( + !defined($format) + || !PVE::Storage::Common::is_volume_type($vtype) + || ($format ne 'subvol' && $format ne 'raw') + ) { return $class->SUPER::free_image($storeid, $scfg, $volname, $isBase, $_format); } diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm index adaca47..e4cf392 100644 --- a/src/PVE/Storage/Plugin.pm +++ b/src/PVE/Storage/Plugin.pm @@ -873,7 +873,7 @@ sub create_base { my ($vtype, $name, $vmid, $basename, $basevmid, $isBase, $format) = $class->parse_volname($volname); - die "create_base on wrong vtype '$vtype'\n" if $vtype ne 'images'; + die "create_base on wrong vtype '$vtype'\n" if !PVE::Storage::Common::is_volume_type($vtype); die "create_base not possible with base image\n" if $isBase; @@ -886,7 +886,12 @@ sub create_base { if $basename && (!$parent || $parent ne "../$basevmid/$basename"); my $newname = $name; - $newname =~ s/^vm-/base-/; + if ($newname =~ /^vm-/) { + # legacy name + $newname =~ s/^vm-/base-/; + } else { + $newname = "base-$newname"; + } my $newvolname = $basename diff --git a/src/PVE/Storage/RBDPlugin.pm b/src/PVE/Storage/RBDPlugin.pm index 839ff73..11639f0 100644 --- a/src/PVE/Storage/RBDPlugin.pm +++ b/src/PVE/Storage/RBDPlugin.pm @@ -663,7 +663,11 @@ sub create_base { if $basename && (!$parent || $parent ne $basename . "@" . $snap); my $newname = $name; - $newname =~ s/^vm-/base-/; + if ($newname =~ /^vol-/) { + $newname = "base-$newname"; + } else { + $newname =~ s/^vm-/base-/; + } my $newvolname = $basename ? "$basename/$newname" : "$newname"; diff --git a/src/PVE/Storage/ZFSPlugin.pm b/src/PVE/Storage/ZFSPlugin.pm index 259e468..fdbe80c 100644 --- a/src/PVE/Storage/ZFSPlugin.pm +++ b/src/PVE/Storage/ZFSPlugin.pm @@ -325,7 +325,11 @@ sub create_base { die "create_base not possible with base image\n" if $isBase; my $newname = $name; - $newname =~ s/^vm-/base-/; + if ($newname =~ /^vm-/) { + $newname =~ s/^vm-/base-/; + } else { + $newname = "base-$newname"; + } my $newvolname = $basename ? "$basename/$newname" : "$newname"; -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel