Skip to content

Commit 6f931db

Browse files
agent: increase timeout for host arch retrieval (#11254) (#11822)
Cherry-picked from 44f8064 Signed-off-by: Abhishek Kumar <[email protected]> Co-authored-by: Abhishek Kumar <[email protected]>
1 parent 86cad79 commit 6f931db

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
@@ -93,7 +93,6 @@
9393
import com.cloud.utils.nio.NioClient;
9494
import com.cloud.utils.nio.NioConnection;
9595
import com.cloud.utils.nio.Task;
96-
import com.cloud.utils.script.OutputInterpreter;
9796
import com.cloud.utils.script.Script;
9897

9998
/**
@@ -598,9 +597,9 @@ protected void setupStartupCommand(final StartupCommand startup) {
598597
}
599598

600599
protected String getAgentArch() {
601-
final Script command = new Script("/usr/bin/arch", 500, logger);
602-
final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
603-
return command.execute(parser);
600+
String arch = Script.runSimpleBashScript(Script.getExecutableAbsolutePath("arch"), 2000);
601+
logger.debug("Arch for agent: {} found: {}", _name, arch);
602+
return arch;
604603
}
605604

606605
@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) {
@@ -248,6 +248,6 @@ private void getHostInfoFromLibvirt() {
248248

249249
private String getCPUArchFromCommand() {
250250
LOGGER.info("Fetching host CPU arch");
251-
return Script.runSimpleBashScript(cpuArchCommand);
251+
return Script.runSimpleBashScript(Script.getExecutableAbsolutePath(cpuArchRetrieveExecutable));
252252
}
253253
}

0 commit comments

Comments
 (0)