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 <f.ebner@proxmox.com>
This commit is contained in:
Fiona Ebner
2025-07-21 14:10:48 +02:00
committed by Wolfgang Bumiller
parent e9e24973fd
commit dd2efb7846

View File

@ -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) = @_;