]> git.proxmox.com Git - pve-guest-common.git/commitdiff
vzdump: schema: make storage for fleecing semi-optional
authorFiona Ebner <f.ebner@proxmox.com>
Thu, 11 Apr 2024 09:29:31 +0000 (11:29 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 11 Apr 2024 17:13:29 +0000 (19:13 +0200)
so it doesn't need to be set when explicitly disabling fleecing. Needs
a custom verifier to enforce it being set when enabled.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/VZDump/Common.pm

index e11fd159e0c20e4ff60d347afe2e71102e84cd9d..153944431347245f443ef12e54cb78ab4466679e 100644 (file)
@@ -95,8 +95,20 @@ PVE::JSONSchema::register_format('backup-fleecing', {
        description => "Use this storage to storage fleecing images. For efficient space usage,"
            ." it's best to use a local storage that supports discard and either thin provisioning"
            ." or sparse files.",
+       optional => 1,
     }),
-});
+}, \&verify_backup_fleecing);
+
+sub verify_backup_fleecing {
+    my ($param, $noerr) = @_;
+
+    if (!$param->{storage} && $param->{enabled}) {
+       return if $noerr;
+       die "'storage' parameter is required when 'enabled' is set\n";
+    }
+
+    return $param;
+}
 
 PVE::JSONSchema::register_format('backup-performance', {
     'max-workers' => {