This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 55d2d26449c kvm: make UEFI host check to support both Ubuntu and EL 
(#7084)
55d2d26449c is described below

commit 55d2d26449caeaf9da5be75f701b225b52e4a134
Author: Rohit Yadav <[email protected]>
AuthorDate: Mon Jan 16 18:42:53 2023 +0530

    kvm: make UEFI host check to support both Ubuntu and EL (#7084)
    
    Signed-off-by: Rohit Yadav <[email protected]>
---
 .../cloud/hypervisor/kvm/resource/LibvirtComputingResource.java  | 4 ++--
 .../kvm/resource/wrapper/LibvirtReadyCommandWrapper.java         | 9 ++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 39145006411..04e981a7873 100644
--- 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -3072,10 +3072,10 @@ public class LibvirtComputingResource extends 
ServerResourceBase implements Serv
         }
         return enableIoUringConfig != null ?
                 enableIoUringConfig:
-                (isBaseOsUbuntu() || isIoUringSupportedByQemu());
+                (isUbuntuHost() || isIoUringSupportedByQemu());
     }
 
-    private boolean isBaseOsUbuntu() {
+    public boolean isUbuntuHost() {
         Map<String, String> versionString = getVersionStrings();
         String hostKey = "Host.OS";
         if (MapUtils.isEmpty(versionString) || 
!versionString.containsKey(hostKey) || versionString.get(hostKey) == null) {
diff --git 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReadyCommandWrapper.java
 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReadyCommandWrapper.java
index a45f11bea83..fc57cd412f0 100644
--- 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReadyCommandWrapper.java
+++ 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReadyCommandWrapper.java
@@ -42,18 +42,21 @@ public final class LibvirtReadyCommandWrapper extends 
CommandWrapper<ReadyComman
     public Answer execute(final ReadyCommand command, final 
LibvirtComputingResource libvirtComputingResource) {
         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());
         }
 
         return new ReadyAnswer(command, hostDetails);
     }
 
-    private boolean hostSupportsUefi() {
+    private boolean hostSupportsUefi(boolean isUbuntuHost) {
         String cmd = "rpm -qa | grep -i ovmf";
+        if (isUbuntuHost) {
+            cmd = "dpkg -l ovmf";
+        }
         s_logger.debug("Running command : " + cmd);
         int result = Script.runSimpleBashScriptForExitValue(cmd);
         s_logger.debug("Got result : " + result);
         return result == 0;
     }
-}
\ No newline at end of file
+}

Reply via email to