public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Elias Huhsovitz <e.huhsovitz@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Elias Huhsovitz <e.huhsovitz@proxmox.com>
Subject: [PATCH manager 3/3] api: nodes: use resolve_nodename helper for bulk operation
Date: Tue, 14 Jul 2026 16:50:27 +0200	[thread overview]
Message-ID: <20260714145027.53038-4-e.huhsovitz@proxmox.com> (raw)
In-Reply-To: <20260714145027.53038-1-e.huhsovitz@proxmox.com>

The startall, stopall, and suspendall endpoints already contained inline
logic to resolve the 'localhost' alias to the actual node name. Refactor
these endpoints to use the new PVE::INotify::resolve_nodename() helper,
improving consistency.

Signed-off-by: Elias Huhsovitz <e.huhsovitz@proxmox.com>
---
 PVE/API2/Ceph/MDS.pm | 3 +--
 PVE/API2/Nodes.pm    | 9 +++------
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/PVE/API2/Ceph/MDS.pm b/PVE/API2/Ceph/MDS.pm
index 31b6fb7e..f9986d03 100644
--- a/PVE/API2/Ceph/MDS.pm
+++ b/PVE/API2/Ceph/MDS.pm
@@ -167,8 +167,7 @@ __PACKAGE__->register_method({
         my $rpcenv = PVE::RPCEnvironment::get();
         my $authuser = $rpcenv->get_user();
 
-        my $nodename = $param->{node};
-        $nodename = INotify::nodename() if $nodename eq 'localhost';
+        my $nodename = PVE::INotify::resolve_nodename($param->{node});
 
         my $mds_id = $param->{name} // $nodename;
 
diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 90ce3c10..143da68a 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -2182,8 +2182,7 @@ __PACKAGE__->register_method({
             }
         }
 
-        my $nodename = $param->{node};
-        $nodename = PVE::INotify::nodename() if $nodename eq 'localhost';
+        my $nodename = PVE::INotify::resolve_nodename($param->{node});
 
         my $force = $param->{force};
 
@@ -2380,8 +2379,7 @@ __PACKAGE__->register_method({
             }
         }
 
-        my $nodename = $param->{node};
-        $nodename = PVE::INotify::nodename() if $nodename eq 'localhost';
+        my $nodename = PVE::INotify::resolve_nodename($param->{node});
 
         my $code = sub {
 
@@ -2518,8 +2516,7 @@ __PACKAGE__->register_method({
             }
         }
 
-        my $nodename = $param->{node};
-        $nodename = PVE::INotify::nodename() if $nodename eq 'localhost';
+        my $nodename = PVE::INotify::resolve_nodename($param->{node});
 
         my $code = sub {
 
-- 
2.47.3





      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 ` [PATCH common 1/3] inotify: add helper to resolve 'localhost' node alias Elias Huhsovitz
2026-07-14 14:50 ` [PATCH manager 2/3] fix #7803: api: nodes: resolve 'localhost' alias in node-specific endpoints Elias Huhsovitz
2026-07-14 14:57   ` Shannon Sterz
2026-07-14 14:50 ` Elias Huhsovitz [this message]

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-4-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 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