Skip to content

Commit 7a5b413

Browse files
committed
nfs: update show pools command to display pure IPs
Motivation: The output tries to print unresolved host names which makes it a bit unreadable: poolA: DS: 00000001000000000000000000000000, InetAddress: [/[2001:638::22]:33141, /131.1.6.4:33141] Modification: Manually convert an array of InetSocketAddress to a string form. Result: poolA: DS: 00000001000000000000000000000000, InetAddress: [[2001:638::22]:33141, 131.1.6.4:33141] Acked-by: Paul Millar Target: master Require-book: no Require-notes: no
1 parent f77a00a commit 7a5b413

File tree

1 file changed

+10
-1
lines changed
  • modules/dcache-nfs/src/main/java/org/dcache/chimera/nfsv41/door

1 file changed

+10
-1
lines changed

modules/dcache-nfs/src/main/java/org/dcache/chimera/nfsv41/door/NFSv41Door.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,10 +1395,19 @@ public String getName() {
13951395
return _name;
13961396
}
13971397

1398+
/**
1399+
* Convert array of InetSocketAddress to a string representation.
1400+
*/
1401+
private static String addrArrayToString(InetSocketAddress[] addresses) {
1402+
return Stream.of(addresses)
1403+
.map(s -> InetAddresses.toUriString(s.getAddress()) + ":" + s.getPort())
1404+
.collect(Collectors.joining(", ", "[", "]"));
1405+
}
1406+
13981407
@Override
13991408
public String toString() {
14001409
return String.format("%s: DS: %s, InetAddress: %s",
1401-
_name, _deviceId, Arrays.toString(_socketAddress));
1410+
_name, _deviceId, addrArrayToString(_socketAddress));
14021411
}
14031412
}
14041413

0 commit comments

Comments
 (0)