[pve-devel] [PATCH storage] pbs: update attribute: cleaner error message if not supported

Fabian Ebner f.ebner at proxmox.com
Fri Nov 12 15:29:42 CET 2021


Reported-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/Storage/PBSPlugin.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/PVE/Storage/PBSPlugin.pm b/PVE/Storage/PBSPlugin.pm
index 06ebfa7..e186663 100644
--- a/PVE/Storage/PBSPlugin.pm
+++ b/PVE/Storage/PBSPlugin.pm
@@ -881,7 +881,12 @@ sub update_volume_attribute {
 	my $conn = pbs_api_connect($scfg, $password);
 	my $datastore = $scfg->{datastore};
 
-	$conn->put("/api2/json/admin/datastore/$datastore/$attribute", $param);
+	eval { $conn->put("/api2/json/admin/datastore/$datastore/$attribute", $param); };
+	if (my $err = $@) {
+	    die "Server is not recent enough to support feature '$attribute'\n"
+		if $err->{code} == 404;
+	    die $err;
+	}
 	return;
     }
 
-- 
2.30.2






More information about the pve-devel mailing list