On 11/17/25 16:32, Fiona Ebner wrote:
Am 17.11.25 um 12:31 PM schrieb Robert Obkircher:
On 11/13/25 17:35, Fiona Ebner wrote:
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"?
I was specifically thinking about eager/lazy evaluation.
Personally, I wouldn't call having code inside a CODE ref/sub variable
"lazily evaluated". The code hasn't been called yet, not just not
evaluated. Or do you mean something else?
What I meant was that $WARNFD itself used to be lazily initialized on
first use (like a LazyLock in Rust) and I moved that initialization to
the definition to ensure that it happens outside of a potential chroot.
I will send a v6 with a better comment and a small change to the path
concatenation in the fourth commit.
_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel