Skip to content

Commit 44f8064

Browse files
authored
agent: increase timeout for host arch retrieval (#11254)
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent b479d37 commit 44f8064

File tree

2 files changed

+5
-6
lines changed
  • agent/src/main/java/com/cloud/agent
  • plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/linux

2 files changed

+5
-6
lines changed

agent/src/main/java/com/cloud/agent/Agent.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
import com.cloud.utils.nio.NioClient;
9898
import com.cloud.utils.nio.NioConnection;
9999
import com.cloud.utils.nio.Task;
100-
import com.cloud.utils.script.OutputInterpreter;
101100
import com.cloud.utils.script.Script;
102101

103102
/**
@@ -614,9 +613,9 @@ protected void setupStartupCommand(final StartupCommand startup) {
614613
}
615614

616615
protected String getAgentArch() {
617-
final Script command = new Script("/usr/bin/arch", 500, logger);
618-
final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
619-
return command.execute(parser);
616+
String arch = Script.runSimpleBashScript(Script.getExecutableAbsolutePath("arch"), 1000);
617+
logger.debug("Arch for agent: {} found: {}", _name, arch);
618+
return arch;
620619
}
621620

622621
@Override

plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/linux/KVMHostInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class KVMHostInfo {
5858
private long reservedMemory;
5959
private long overCommitMemory;
6060
private List<String> capabilities = new ArrayList<>();
61-
private static String cpuArchCommand = "/usr/bin/arch";
61+
private static String cpuArchRetrieveExecutable = "arch";
6262
private static List<String> cpuInfoFreqFileNames = List.of("/sys/devices/system/cpu/cpu0/cpufreq/base_frequency","/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq");
6363

6464
public KVMHostInfo(long reservedMemory, long overCommitMemory, long manualSpeed, int reservedCpus) {
@@ -255,6 +255,6 @@ private void getHostInfoFromLibvirt() {
255255

256256
private String getCPUArchFromCommand() {
257257
LOGGER.info("Fetching host CPU arch");
258-
return Script.runSimpleBashScript(cpuArchCommand);
258+
return Script.runSimpleBashScript(Script.getExecutableAbsolutePath(cpuArchRetrieveExecutable));
259259
}
260260
}

0 commit comments

Comments
 (0)