Skip to content

Commit 380c3fb

Browse files
committed
Fix timeout for hostSupportsUefi in libvirt ready command wrapper
1 parent 1925040 commit 380c3fb

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReadyCommandWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private boolean hostSupportsUefi(boolean isUbuntuHost) {
5555
cmd = "dpkg -l ovmf";
5656
}
5757
s_logger.debug("Running command : " + cmd);
58-
int result = Script.runSimpleBashScriptForExitValue(cmd, 60, false);
58+
int result = Script.runSimpleBashScriptForExitValue(cmd, 60 * 1000, false);
5959
s_logger.debug("Got result : " + result);
6060
return result == 0;
6161
}

utils/src/main/java/com/cloud/utils/script/Script.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,19 @@ public static int runSimpleBashScriptForExitValueAvoidLogging(String command) {
531531
return runSimpleBashScriptForExitValue(command, 0, true);
532532
}
533533

534+
/**
535+
* Executes a bash script and returns the exit value of the script.
536+
*
537+
* @param command
538+
* The bash command to be executed.
539+
* @param timeout
540+
* The maximum time (in milliseconds) that the script is allowed to run before it is forcibly terminated.
541+
* @param avoidLogging
542+
* If set to true, some logging is avoided.
543+
*
544+
* @return The exit value of the script. Returns -1 if the result is null or empty, or if it cannot be parsed into
545+
* an integer which can happen in case of a timeout.
546+
*/
534547
public static int runSimpleBashScriptForExitValue(String command, int timeout, boolean avoidLogging) {
535548

536549
Script s = new Script("/bin/bash", timeout);

0 commit comments

Comments
 (0)