[pve-devel] [PATCH container v2 1/1] close #1543: allow low-level lxc config update
Simon LEONARD
git-1001af4 at sinux.sh
Sat Mar 22 19:05:59 CET 2025
Signed-off-by: Simon LEONARD <git-1001af4 at sinux.sh>
---
src/PVE/API2/LXC/Config.pm | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/PVE/API2/LXC/Config.pm b/src/PVE/API2/LXC/Config.pm
index 5cbc014..5e48338 100644
--- a/src/PVE/API2/LXC/Config.pm
+++ b/src/PVE/API2/LXC/Config.pm
@@ -123,7 +123,13 @@ __PACKAGE__->register_method({
description => 'Prevent changes if current configuration file has different SHA1 digest. This can be used to prevent concurrent modifications.',
maxLength => 40,
optional => 1,
- }
+ },
+ lxc => {
+ description => "Array of lxc low-level configurations ([[key1, value1], [key2, value2] ...]).",
+ type => 'array',
+ items => { type => 'array', items => { type => 'string' }},
+ optional => 1,
+ },
}),
},
returns => { type => 'null'},
@@ -208,6 +214,15 @@ __PACKAGE__->register_method({
my $running = PVE::LXC::check_running($vmid);
+ if (defined $param->{lxc}) {
+ for my $entry (@{$param->{lxc}}) {
+ my ($key, $value) = @$entry;
+ die "invalid lxc config key '$key'\n"
+ unless PVE::LXC::Config::is_valid_lxc_conf_key($key);
+ }
+ $conf->{lxc} = $param->{lxc};
+ }
+
my $errors = PVE::LXC::Config->update_pct_config($vmid, $conf, $running, $param, \@delete, \@revert);
# don't write to config if we get any errors – this can result in a broken config
raise_param_exc($errors) if scalar(keys %$errors);
--
2.48.1
More information about the pve-devel
mailing list