[pve-devel] [PATCH container v2 10/11] api: update_vm: use volume content type assertion helpers

Daniel Kral d.kral at proxmox.com
Tue Feb 11 17:08:24 CET 2025


Make use of the newly introduced content type assertion helpers at
verifying the added and/or changed container config values, which is
called e.g. in the API handler for updating the container config.

Signed-off-by: Daniel Kral <d.kral at proxmox.com>
---
changes since v1:
- new!

 src/PVE/LXC/Config.pm | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 0740e8c..83b6b47 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1176,9 +1176,7 @@ sub update_pct_config {
     my $check_content_type = sub {
 	my ($mp) = @_;
 	my $sid = PVE::Storage::parse_volume_id($mp->{volume});
-	my $storage_config = PVE::Storage::storage_config($storage_cfg, $sid);
-	die "storage '$sid' does not allow content type 'rootdir' (Container)\n"
-	    if !$storage_config->{content}->{rootdir};
+	PVE::Storage::assert_content_type_supported($storage_cfg, $sid, 'rootdir');
     };
 
     foreach my $opt (sort keys %$param) { # add/change
-- 
2.39.5





More information about the pve-devel mailing list