plugin: add get_formats() method and use it instead of default_format()

The LVM plugin can only use qcow2 format when the
'snapshot-as-volume-chain' configuration option is set. The format
information is currently only recorded statically in the plugin data.
This causes issues, for example, restoring a guest volume that uses
qcow2 as a format hint on an LVM storage without the option set will
fail, because the plugin data indicates that qcow2 is supported.
Introduce a dedicated method, so that plugins can indicate what
actually is supported according to the storage configuration.

The implementation for LVM is done in a separate commit.

Remove the now unused default_format() function from Plugin.pm.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
[WB: docs: add missing params, drop =pod line, use !! for bools]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Fiona Ebner
2025-07-21 14:10:47 +02:00
committed by Wolfgang Bumiller
parent cd7c8e0ce6
commit e9e24973fd
3 changed files with 57 additions and 27 deletions

View File

@ -49,6 +49,14 @@ Future changes should be documented in here.
NOTE: Storages must support using "current" as a special name in `rename_snapshot()` to
cheaply convert a snapshot into the current disk state and back.
* Introduce `get_formats()` plugin method
Get information about the supported formats and default format according to the current storage
configuration. The default implemenation is backwards-compatible with previous behavior and looks
at the definition given in the plugin data, as well as the `format` storage configuration option,
which can override the default format. Must be implemented when the supported formats or default
format depend on the storage configuration.
## Version 11:
* Allow declaring storage features via plugin data