From: Elias Huhsovitz <e.huhsovitz@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Elias Huhsovitz <e.huhsovitz@proxmox.com>
Subject: [PATCH common 1/3] inotify: add helper to resolve 'localhost' node alias
Date: Tue, 14 Jul 2026 16:50:25 +0200 [thread overview]
Message-ID: <20260714145027.53038-2-e.huhsovitz@proxmox.com> (raw)
In-Reply-To: <20260714145027.53038-1-e.huhsovitz@proxmox.com>
Several API endpoints accept 'localhost' as a valid node alias via the
API routing layer. However, the endpoint handlers often use the literal
string 'localhost' to construct file paths in the cluster filesystem
(e.g., /etc/pve/nodes/localhost/config), which fails because no actual
node directory with that name exists.
Add a PVE::INotify::resolve_nodename() helper to centralize the
translation of 'localhost' to the actual node name. This ensures
consistent behavior. across multiple API handlers.
Signed-off-by: Elias Huhsovitz <e.huhsovitz@proxmox.com>
---
src/PVE/INotify.pm | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index 53b4e21..25ea0b8 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -533,6 +533,11 @@ sub nodename {
return $cached_nodename;
}
+sub resolve_nodename {
+ my ($node) = @_;
+ return $node eq 'localhost' ? nodename() : $node;
+}
+
sub read_etc_hostname {
my ($filename, $fd) = @_;
--
2.47.3
next prev parent reply other threads:[~2026-07-14 14:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 14:50 [PATCH common/manager 0/3] fix #7803: 'localhost' alias handling in node-specific endpoints Elias Huhsovitz
2026-07-14 14:50 ` Elias Huhsovitz [this message]
2026-07-14 14:50 ` [PATCH manager 2/3] fix #7803: api: nodes: resolve 'localhost' alias " Elias Huhsovitz
2026-07-14 14:57 ` Shannon Sterz
2026-07-14 14:50 ` [PATCH manager 3/3] api: nodes: use resolve_nodename helper for bulk operation Elias Huhsovitz
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=20260714145027.53038-2-e.huhsovitz@proxmox.com \
--to=e.huhsovitz@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.