public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Simon LEONARD <git-1001af4@sinux.sh>
To: f.gruenbichler@proxmox.com
Cc: pve-devel@lists.proxmox.com, git-1001af4@sinux.sh
Subject: [pve-devel] [PATCH container v2 1/1] close #1543: allow low-level lxc config update
Date: Sat, 22 Mar 2025 19:05:59 +0100	[thread overview]
Message-ID: <20250322180647.12941-2-git-1001af4@sinux.sh> (raw)
In-Reply-To: <20250322180647.12941-1-git-1001af4@sinux.sh>

Signed-off-by: Simon LEONARD <git-1001af4@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


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

  reply	other threads:[~2025-03-24 10:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-23 22:29 [pve-devel] [PATCH container 0/1] close #1543: allow low-level lxc update Simon LEONARD
2025-01-23 22:29 ` [pve-devel] [PATCH container 1/1] " Simon LEONARD
2025-01-27 11:05   ` Fabian Grünbichler
2025-03-22 18:05     ` [pve-devel] [PATCH container v2 0/1] close #1543: allow low-level lxc config Simon LEONARD
2025-03-22 18:05       ` Simon LEONARD [this message]
2025-03-24 15:01       ` Fabian Grünbichler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250322180647.12941-2-git-1001af4@sinux.sh \
    --to=git-1001af4@sinux.sh \
    --cc=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal