mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
kvm: make UEFI host check to support both Ubuntu and EL (#7084)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
52c321a0c6
commit
55d2d26449
@ -3072,10 +3072,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
}
|
}
|
||||||
return enableIoUringConfig != null ?
|
return enableIoUringConfig != null ?
|
||||||
enableIoUringConfig:
|
enableIoUringConfig:
|
||||||
(isBaseOsUbuntu() || isIoUringSupportedByQemu());
|
(isUbuntuHost() || isIoUringSupportedByQemu());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBaseOsUbuntu() {
|
public boolean isUbuntuHost() {
|
||||||
Map<String, String> versionString = getVersionStrings();
|
Map<String, String> versionString = getVersionStrings();
|
||||||
String hostKey = "Host.OS";
|
String hostKey = "Host.OS";
|
||||||
if (MapUtils.isEmpty(versionString) || !versionString.containsKey(hostKey) || versionString.get(hostKey) == null) {
|
if (MapUtils.isEmpty(versionString) || !versionString.containsKey(hostKey) || versionString.get(hostKey) == null) {
|
||||||
|
|||||||
@ -42,18 +42,21 @@ public final class LibvirtReadyCommandWrapper extends CommandWrapper<ReadyComman
|
|||||||
public Answer execute(final ReadyCommand command, final LibvirtComputingResource libvirtComputingResource) {
|
public Answer execute(final ReadyCommand command, final LibvirtComputingResource libvirtComputingResource) {
|
||||||
Map<String, String> hostDetails = new HashMap<String, String>();
|
Map<String, String> hostDetails = new HashMap<String, String>();
|
||||||
|
|
||||||
if (hostSupportsUefi() && libvirtComputingResource.isUefiPropertiesFileLoaded()) {
|
if (hostSupportsUefi(libvirtComputingResource.isUbuntuHost()) && libvirtComputingResource.isUefiPropertiesFileLoaded()) {
|
||||||
hostDetails.put(Host.HOST_UEFI_ENABLE, Boolean.TRUE.toString());
|
hostDetails.put(Host.HOST_UEFI_ENABLE, Boolean.TRUE.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ReadyAnswer(command, hostDetails);
|
return new ReadyAnswer(command, hostDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hostSupportsUefi() {
|
private boolean hostSupportsUefi(boolean isUbuntuHost) {
|
||||||
String cmd = "rpm -qa | grep -i ovmf";
|
String cmd = "rpm -qa | grep -i ovmf";
|
||||||
|
if (isUbuntuHost) {
|
||||||
|
cmd = "dpkg -l ovmf";
|
||||||
|
}
|
||||||
s_logger.debug("Running command : " + cmd);
|
s_logger.debug("Running command : " + cmd);
|
||||||
int result = Script.runSimpleBashScriptForExitValue(cmd);
|
int result = Script.runSimpleBashScriptForExitValue(cmd);
|
||||||
s_logger.debug("Got result : " + result);
|
s_logger.debug("Got result : " + result);
|
||||||
return result == 0;
|
return result == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user