Skip to content

Commit 3e1b50d

Browse files
shwstpprdhslove
authored andcommitted
agent: increase timeout for host arch retrieval (apache#11254)
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent 59e2595 commit 3e1b50d

File tree

2 files changed

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

2 files changed

+5
-5
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public class KVMHostInfo {
6363
private static String cpuInfoFreqFileName = "/sys/devices/system/cpu/cpu0/cpufreq/base_frequency";
6464
private static String cpuInfoFreqFileNameforAMD = "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq";
6565
private static String cpuArchCommand = "/usr/bin/arch";
66+
private static String cpuArchRetrieveExecutable = "arch";
6667
private static List<String> cpuInfoFreqFileNames = List.of("/sys/devices/system/cpu/cpu0/cpufreq/base_frequency","/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq");
6768

6869
public KVMHostInfo(long reservedMemory, long overCommitMemory, long manualSpeed, int reservedCpus) {
@@ -266,6 +267,6 @@ private void getHostInfoFromLibvirt() {
266267

267268
private String getCPUArchFromCommand() {
268269
LOGGER.info("Fetching host CPU arch");
269-
return Script.runSimpleBashScript(cpuArchCommand);
270+
return Script.runSimpleBashScript(Script.getExecutableAbsolutePath(cpuArchRetrieveExecutable));
270271
}
271272
}

0 commit comments

Comments
 (0)