* [PATCH container] api: template: allow creating template from ct with disk on LVM
@ 2026-03-12 18:27 Lukas Sichert
2026-08-24 15:33 ` Fiona Ebner
2026-10-07 11:08 ` Elias Huhsovitz
0 siblings, 2 replies; 3+ messages in thread
From: Lukas Sichert @ 2026-03-12 18:27 UTC (permalink / raw)
To: pve-devel; +Cc: Lukas Sichert
Currently, in the UI, one can create a template from a VM with a disk on
LVM storage, but not from a container. This is because the LVM plugin
does not have the functionality to create base images from disks
implemented. While the system simply skips this function for VMs, it
throws an error and aborts for LXC containers.
To allow converting to a template, skip the volumes where the required
functionality is not present by exiting early instead of aborting.
Signed-off-by: Lukas Sichert <l.sichert@proxmox.com>
---
src/PVE/LXC.pm | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index caba952..e77d208 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1613,17 +1613,7 @@ sub template_create {
my $volid = $mountpoint->{volume};
- die "Template feature is not available for '$volid'\n"
- if !PVE::Storage::volume_has_feature($storecfg, 'template', $volid);
- },
- );
-
- PVE::LXC::Config->foreach_volume(
- $conf,
- sub {
- my ($ms, $mountpoint) = @_;
-
- my $volid = $mountpoint->{volume};
+ return if !PVE::Storage::volume_has_feature($storecfg, 'template', $volid);
PVE::Storage::activate_volumes($storecfg, [$volid]);
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH container] api: template: allow creating template from ct with disk on LVM
2026-03-12 18:27 [PATCH container] api: template: allow creating template from ct with disk on LVM Lukas Sichert
@ 2026-08-24 15:33 ` Fiona Ebner
2026-10-07 11:08 ` Elias Huhsovitz
1 sibling, 0 replies; 3+ messages in thread
From: Fiona Ebner @ 2026-08-24 15:33 UTC (permalink / raw)
To: Lukas Sichert, pve-devel
Am 12.03.26 um 7:26 PM schrieb Lukas Sichert:
> Currently, in the UI, one can create a template from a VM with a disk on
> LVM storage, but not from a container. This is because the LVM plugin
> does not have the functionality to create base images from disks
> implemented. While the system simply skips this function for VMs, it
> throws an error and aborts for LXC containers.
>
> To allow converting to a template, skip the volumes where the required
> functionality is not present by exiting early instead of aborting.
>
I feel like we should properly implement the feature the LVM plugin
instead and maybe start requiring the feature for VMs with the next
major version too, but not super important. The implementation for the
LVM plugin can be similar to what is done for LVM-thin, i.e. rename and
set readonly and activationskip flags.
> Signed-off-by: Lukas Sichert <l.sichert@proxmox.com>
> ---
> src/PVE/LXC.pm | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
> index caba952..e77d208 100644
> --- a/src/PVE/LXC.pm
> +++ b/src/PVE/LXC.pm
> @@ -1613,17 +1613,7 @@ sub template_create {
>
> my $volid = $mountpoint->{volume};
>
> - die "Template feature is not available for '$volid'\n"
> - if !PVE::Storage::volume_has_feature($storecfg, 'template', $volid);
> - },
> - );
> -
> - PVE::LXC::Config->foreach_volume(
> - $conf,
> - sub {
> - my ($ms, $mountpoint) = @_;
> -
> - my $volid = $mountpoint->{volume};
> + return if !PVE::Storage::volume_has_feature($storecfg, 'template', $volid);
>
> PVE::Storage::activate_volumes($storecfg, [$volid]);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH container] api: template: allow creating template from ct with disk on LVM
2026-03-12 18:27 [PATCH container] api: template: allow creating template from ct with disk on LVM Lukas Sichert
2026-08-24 15:33 ` Fiona Ebner
@ 2026-10-07 11:08 ` Elias Huhsovitz
1 sibling, 0 replies; 3+ messages in thread
From: Elias Huhsovitz @ 2026-10-07 11:08 UTC (permalink / raw)
To: Lukas Sichert, pve-devel
I agree with @Fiona [1], but IMO this a good intermediate solution and I
don't see any downside in applying this.
The current state is somewhat annoying and this patch makes the
behaviour more consistent with VM equivalent function.
I gave this a quick test with a container containing 2 volumes:
- Root Disk: lvm-thin
- mp0: lvm
Creating the template worked without issues.
When attempting to create a linked clone of the template, the user is
correctly stopped with an error.
Creating a full clone worked without any issues.
Reviewed-by: Elias Huhsovitz <e.huhsovitz@proxmox.com>
Tested-by: Elias Huhsovitz <e.huhsovitz@proxmox.com>
[1] https://lore.proxmox.com/pve-devel/328e1266-003a-42fd-bfea-2801b5afb88d@proxmox.com/
On Thu Mar 12, 2026 at 7:27 PM CET, Lukas Sichert wrote:
> Currently, in the UI, one can create a template from a VM with a disk on
> LVM storage, but not from a container. This is because the LVM plugin
> does not have the functionality to create base images from disks
> implemented. While the system simply skips this function for VMs, it
> throws an error and aborts for LXC containers.
>
> To allow converting to a template, skip the volumes where the required
> functionality is not present by exiting early instead of aborting.
>
> Signed-off-by: Lukas Sichert <l.sichert@proxmox.com>
> ---
> src/PVE/LXC.pm | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
> index caba952..e77d208 100644
> --- a/src/PVE/LXC.pm
> +++ b/src/PVE/LXC.pm
> @@ -1613,17 +1613,7 @@ sub template_create {
>
> my $volid = $mountpoint->{volume};
>
> - die "Template feature is not available for '$volid'\n"
> - if !PVE::Storage::volume_has_feature($storecfg, 'template', $volid);
> - },
> - );
> -
> - PVE::LXC::Config->foreach_volume(
> - $conf,
> - sub {
> - my ($ms, $mountpoint) = @_;
> -
> - my $volid = $mountpoint->{volume};
> + return if !PVE::Storage::volume_has_feature($storecfg, 'template', $volid);
>
> PVE::Storage::activate_volumes($storecfg, [$volid]);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-07 11:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 18:27 [PATCH container] api: template: allow creating template from ct with disk on LVM Lukas Sichert
2026-08-24 15:33 ` Fiona Ebner
2026-10-07 11:08 ` Elias Huhsovitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox