From dd2efb7846e0788fc10d299847b48a2f9efe3fd3 Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Mon, 21 Jul 2025 14:10:48 +0200 Subject: [PATCH] lvm plugin: implement get_formats() method As the alloc_lvm_image() helper asserts, qcow2 cannot be used as a format without the 'snapshot-as-volume-chain' configuration option. Therefore it is necessary to implement get_formats() and distinguish based on the storage configuration. In case the 'snapshot-as-volume-chain' option is set, qcow2 is even preferred and thus declared the default format. Signed-off-by: Fiona Ebner --- src/PVE/Storage/LVMPlugin.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm index 8be2a10..1690e97 100644 --- a/src/PVE/Storage/LVMPlugin.pm +++ b/src/PVE/Storage/LVMPlugin.pm @@ -405,6 +405,16 @@ sub options { # Storage implementation +sub get_formats { + my ($class, $scfg, $storeid) = @_; + + if ($scfg->{'snapshot-as-volume-chain'}) { + return { default => 'qcow2', valid => { 'qcow2' => 1, 'raw' => 1, } }; + } + + return { default => 'raw', valid => { 'raw' => 1 } }; +} + sub on_add_hook { my ($class, $storeid, $scfg, %param) = @_;