Skip to content

Commit 55d2d26

Browse files
authored
kvm: make UEFI host check to support both Ubuntu and EL (#7084)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 52c321a commit 55d2d26

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3072,10 +3072,10 @@ private boolean isIoUringEnabled(Boolean enableIoUringConfig) {
30723072
}
30733073
return enableIoUringConfig != null ?
30743074
enableIoUringConfig:
3075-
(isBaseOsUbuntu() || isIoUringSupportedByQemu());
3075+
(isUbuntuHost() || isIoUringSupportedByQemu());
30763076
}
30773077

3078-
private boolean isBaseOsUbuntu() {
3078+
public boolean isUbuntuHost() {
30793079
Map<String, String> versionString = getVersionStrings();
30803080
String hostKey = "Host.OS";
30813081
if (MapUtils.isEmpty(versionString) || !versionString.containsKey(hostKey) || versionString.get(hostKey) == null) {

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,21 @@ public final class LibvirtReadyCommandWrapper extends CommandWrapper<ReadyComman
4242
public Answer execute(final ReadyCommand command, final LibvirtComputingResource libvirtComputingResource) {
4343
Map<String, String> hostDetails = new HashMap<String, String>();
4444

45-
if (hostSupportsUefi() && libvirtComputingResource.isUefiPropertiesFileLoaded()) {
45+
if (hostSupportsUefi(libvirtComputingResource.isUbuntuHost()) && libvirtComputingResource.isUefiPropertiesFileLoaded()) {
4646
hostDetails.put(Host.HOST_UEFI_ENABLE, Boolean.TRUE.toString());
4747
}
4848

4949
return new ReadyAnswer(command, hostDetails);
5050
}
5151

52-
private boolean hostSupportsUefi() {
52+
private boolean hostSupportsUefi(boolean isUbuntuHost) {
5353
String cmd = "rpm -qa | grep -i ovmf";
54+
if (isUbuntuHost) {
55+
cmd = "dpkg -l ovmf";
56+
}
5457
s_logger.debug("Running command : " + cmd);
5558
int result = Script.runSimpleBashScriptForExitValue(cmd);
5659
s_logger.debug("Got result : " + result);
5760
return result == 0;
5861
}
59-
}
62+
}

0 commit comments

Comments
 (0)