All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: Chuck Lever <cel@kernel.org>, Daniel Gomez <da.gomez@kruces.com>,
	kdevops@lists.linux.dev
Cc: Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH 1/5] systemd-remote: use ip address for systemd-remote journal
Date: Sat, 19 Apr 2025 22:48:17 -0700	[thread overview]
Message-ID: <20250420054822.533987-2-mcgrof@kernel.org> (raw)
In-Reply-To: <20250420054822.533987-1-mcgrof@kernel.org>

We have to run 'make journal-ln' to make the hostname match,
but we can just use a ssh -G trick to get the IP address since
we already have that on our ssh configuration. This means we
can later kill running 'make journal-ln'.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 scripts/workflows/lib/systemd_remote.py | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/scripts/workflows/lib/systemd_remote.py b/scripts/workflows/lib/systemd_remote.py
index f7ce4b556de1..c95ca7e57bd5 100644
--- a/scripts/workflows/lib/systemd_remote.py
+++ b/scripts/workflows/lib/systemd_remote.py
@@ -13,6 +13,16 @@ class TimeoutExpired(SystemdError):
         self.error_code = errcode
         return "timeout"
 
+def get_host_ip(host):
+    try:
+        result = subprocess.run(["ssh", "-G", host], capture_output=True, text=True, check=True)
+        for line in result.stdout.splitlines():
+            if line.startswith("hostname "):
+                return line.split()[1]
+    except subprocess.SubprocessError as e:
+        logger.warning(f"Failed to resolve IP for {host}: {e}")
+    return None
+
 def get_current_time(host):
     format = '%Y-%m-%d %H:%M:%S'
     today = datetime.today()
@@ -20,7 +30,8 @@ def get_current_time(host):
     return today_str
 
 def get_extra_journals(remote_path, host):
-    extra_journals_path = "remote-" + host + '@'
+    ip = get_host_ip(host)
+    extra_journals_path = "remote-" + ip + '@'
     extra_journals = []
     for file in os.listdir(remote_path):
         if extra_journals_path in file:
@@ -29,8 +40,9 @@ def get_extra_journals(remote_path, host):
     return extra_journals
 
 def get_uname(remote_path, host, configured_kernel):
+    ip = get_host_ip(host)
     extra_journals = get_extra_journals(remote_path, host)
-    fpath = remote_path + "remote-" + host + '.journal'
+    fpath = remote_path + "remote-" + ip + '.journal'
     grep = "Linux version"
     grep_str = "\"Linux version\""
     cmd = [
@@ -90,10 +102,11 @@ def get_uname(remote_path, host, configured_kernel):
 
 # Returns something like "xfs/040 at 2023-12-17 23:52:14"
 def get_test(remote_path, host, suite):
+    ip = get_host_ip(host)
     if suite not in [ 'fstests', 'blktests']:
         return None
     # Example: /var/log/journal/remote/remote-line-xfs-reflink.journal
-    fpath = remote_path + "remote-" + host + '.journal'
+    fpath = remote_path + "remote-" + ip + '.journal'
     extra_journals = get_extra_journals(remote_path, host)
     run_string = "run " + suite
     cmd = [
-- 
2.47.2


  reply	other threads:[~2025-04-20  5:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-20  5:48 [PATCH 0/5] crash: provide a crash watchdog Luis Chamberlain
2025-04-20  5:48 ` Luis Chamberlain [this message]
2025-04-20  5:48 ` [PATCH 2/5] crash: add kernel crash watchdog library Luis Chamberlain
2025-04-20  5:48 ` [PATCH 3/5] fstests_watchdog.py: use the new " Luis Chamberlain
2025-04-20  5:48 ` [PATCH 4/5] crash_watchdog.py: add generic crash watchdog Luis Chamberlain
2025-04-20  5:48 ` [PATCH 5/5] crash_report.py: add a crash report Luis Chamberlain
2025-04-20 15:19 ` [PATCH 0/5] crash: provide a crash watchdog Chuck Lever
2025-04-21 23:16   ` Luis Chamberlain
2025-04-22  2:38     ` Luis Chamberlain

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=20250420054822.533987-2-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=cel@kernel.org \
    --cc=da.gomez@kruces.com \
    --cc=kdevops@lists.linux.dev \
    /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.