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 035C31FF17E for ; Thu, 13 Nov 2025 17:36:00 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 648E123F38; Thu, 13 Nov 2025 17:36:53 +0100 (CET) Message-ID: <6c3edd7e-cf58-4805-a107-3e9c69d86cd5@proxmox.com> Date: Thu, 13 Nov 2025 17:36:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Proxmox VE development discussion , Robert Obkircher References: <20251113150342.101933-1-r.obkircher@proxmox.com> <20251113150342.101933-3-r.obkircher@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: <20251113150342.101933-3-r.obkircher@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1763051755205 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 Subject: Re: [pve-devel] [PATCH v4 pve-container 2/5] Propagate prestart-hook warnings to task-log. 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" Am 13.11.25 um 4:04 PM schrieb Robert Obkircher: > diff --git a/src/lxc-pve-prestart-hook b/src/lxc-pve-prestart-hook > index 73125e1..f5dd728 100755 > --- a/src/lxc-pve-prestart-hook > +++ b/src/lxc-pve-prestart-hook > @@ -28,17 +28,6 @@ eval { > $have_sdn = 1; > }; > > -my $WARNFD; > - > -sub log_warn { > - my ($vmid, $message) = @_; > - > - if (!defined($WARNFD)) { > - open($WARNFD, '>', "/run/pve/ct-${vmid}.warnings"); > - } > - print $WARNFD "$message\n"; > -} > - > PVE::LXC::Tools::lxc_hook( > 'pre-start', > 'lxc', > @@ -53,6 +42,15 @@ PVE::LXC::Tools::lxc_hook( > > PVE::RESTEnvironment->setup_default_cli_env(); > > + my $warn_file = "/run/pve/ct-${vmid}.warnings"; > + # open eagerly so logging works inside the protected_call chroot Nit: Maybe "early" instead of "eagerly"? > + open(my $warnfd, '>', $warn_file) or die "Failed to open $warn_file: $!"; > + my $log_warn = sub { > + my ($message) = @_; Nit: I'd add a chomp() so that callers don't need to worry about not including a newline > + print $warnfd "$message\n"; > + $warnfd->flush; # required because protected_call calls POSIX::_exit > + }; > + > return undef if !-f PVE::LXC::Config->config_file($vmid); > > my $conf = PVE::LXC::Config->load_config($vmid); > @@ -155,12 +153,12 @@ PVE::LXC::Tools::lxc_hook( > > PVE::LXC::Config->foreach_passthrough_device($conf, $setup_passthrough_device); > > - my $lxc_setup = PVE::LXC::Setup->new($conf, $rootdir); > + my $lxc_setup = PVE::LXC::Setup->new($conf, $rootdir, undef, $log_warn); > $lxc_setup->pre_start_hook(); > > if (PVE::CGroup::cgroup_mode() == 2) { > if (!$lxc_setup->unified_cgroupv2_support()) { > - log_warn( > + $log_warn->( > $vmid, > "old systemd (< v232) detected, container won't run in a pure cgroupv2" > . " environment! Please see documentation -> container -> cgroup version.", The call here still uses the VMID argument, but the new helper only takes a single argument. _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel