From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id C98AD1FF13E for ; Fri, 23 Jan 2026 15:34:52 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 016EAFB88; Fri, 23 Jan 2026 15:35:03 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Fri, 23 Jan 2026 15:34:22 +0100 Message-ID: <20260123143454.150800-3-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260123143454.150800-1-f.ebner@proxmox.com> References: <20260123143454.150800-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1769178838999 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.017 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [lxc.pm] Subject: [pve-devel] [PATCH container v3 2/8] api: create: reduce scope for $mp_param variable X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Introduce an $api_mp_param variable for better separation to prepare for factoring out a helper. Signed-off-by: Fiona Ebner --- New in v3. src/PVE/API2/LXC.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index 204e1c8..4370c57 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -360,16 +360,16 @@ __PACKAGE__->register_method({ my $is_root = $authuser eq 'root@pam'; my $no_disk_param = {}; - my $mp_param = {}; + my $api_mp_param = {}; my $storage_only_mode = 1; foreach my $opt (keys %$param) { my $value = $param->{$opt}; if ($opt eq 'rootfs' || $opt =~ m/^mp\d+$/) { # allow to use simple numbers (add default storage in that case) if ($value =~ m/^\d+(\.\d+)?$/) { - $mp_param->{$opt} = "$storage:$value"; + $api_mp_param->{$opt} = "$storage:$value"; } else { - $mp_param->{$opt} = $value; + $api_mp_param->{$opt} = $value; } $storage_only_mode = 0; } elsif ($opt =~ m/^unused\d+$/) { @@ -381,11 +381,11 @@ __PACKAGE__->register_method({ } die "mount points configured, but 'rootfs' not set - aborting\n" - if !$storage_only_mode && !defined($mp_param->{rootfs}); + if !$storage_only_mode && !defined($api_mp_param->{rootfs}); # check storage access, activate storage PVE::LXC::Config->foreach_volume( - $mp_param, + $api_mp_param, sub { my ($ms, $mountpoint) = @_; @@ -403,7 +403,7 @@ __PACKAGE__->register_method({ ); # check/activate default storage - &$check_and_activate_storage($storage) if !defined($mp_param->{rootfs}); + &$check_and_activate_storage($storage) if !defined($api_mp_param->{rootfs}); PVE::LXC::Config->update_pct_config($vmid, $conf, 0, $no_disk_param); @@ -465,6 +465,7 @@ __PACKAGE__->register_method({ } } + my $mp_param; my $delayed_mp_param = {}; if ($storage_only_mode) { if ($restore) { @@ -521,8 +522,11 @@ __PACKAGE__->register_method({ }, ); } else { + $mp_param = $api_mp_param; $mp_param->{rootfs} = "$storage:4"; # defaults to 4GB } + } else { + $mp_param = $api_mp_param; } # up until here we did not modify the container, besides the lock -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel