Skip to content

Commit 393f3d7

Browse files
authored
linstor: use relative hostname path (#8633)
As described in issue #8310 some older distributions don't have hostname in /usr/bin so rely on PATH resolving
1 parent 2729ee1 commit 393f3d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private String getLinstorRscName(String name) {
7272

7373
private String getHostname() {
7474
// either there is already some function for that in the agent or a better way.
75-
ProcessBuilder pb = new ProcessBuilder("/usr/bin/hostname");
75+
ProcessBuilder pb = new ProcessBuilder("hostname");
7676
try
7777
{
7878
String result;
@@ -88,7 +88,7 @@ private String getHostname() {
8888
return result.trim();
8989
} catch (IOException | InterruptedException exc) {
9090
Thread.currentThread().interrupt();
91-
throw new CloudRuntimeException("Unable to run '/usr/bin/hostname' command.");
91+
throw new CloudRuntimeException("Unable to run 'hostname' command.");
9292
}
9393
}
9494

0 commit comments

Comments
 (0)