public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Michal Fox <me@dualfroz.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH storage] fix #6441: btrfs: fix cloning templates with non-raw disk images
Date: Sat,  3 Oct 2026 12:15:13 +0000	[thread overview]
Message-ID: <20261003121513.7-1-me@dualfroz.com> (raw)

Cloning a template with a disk image that is neither raw nor a
subvolume, for example a qcow2 image, failed on a BTRFS storage with:

  clone failed: Undefined subroutine &PVE::Storage::DirPlugin::clone_image called

For such images, the BTRFS plugin forwards the call to the DirPlugin.
But the DirPlugin does not implement clone_image itself, it inherits it
from the base plugin, and calling it as a plain function does not go
through the inheritance.

Call the implementation of the base plugin directly instead, like it is
already done for create_base.

Fixes: af50c2e ("add BTRFS storage plugin")
Signed-off-by: Michal Fox <me@dualfroz.com>
---
Tested by calling clone_image of the BTRFS plugin for a qcow2 base image
on a test storage: before, it failed with the error from the bug report,
now it creates the linked clone. The raw and subvol code paths are not
touched.

 src/PVE/Storage/BTRFSPlugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Storage/BTRFSPlugin.pm b/src/PVE/Storage/BTRFSPlugin.pm
index fb47aa0..99aa811 100644
--- a/src/PVE/Storage/BTRFSPlugin.pm
+++ b/src/PVE/Storage/BTRFSPlugin.pm
@@ -291,7 +291,7 @@ sub clone_image {
     # 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
     if ($format ne 'raw' && $format ne 'subvol') {
-        return PVE::Storage::DirPlugin::clone_image(@_);
+        return PVE::Storage::Plugin::clone_image(@_);
     }
 
     my $imagedir = $class->get_subdir($scfg, 'images');
-- 
2.43.0




                 reply	other threads:[~2026-10-03 12:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261003121513.7-1-me@dualfroz.com \
    --to=me@dualfroz.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