You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2023/01/12 06:12:36 UTC

[GitHub] [cloudstack] rohityadavcloud commented on a diff in pull request #6139: agent: Detect existing hosts with UEFI support

rohityadavcloud commented on code in PR #6139:
URL: https://github.com/apache/cloudstack/pull/6139#discussion_r1067737491


##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReadyCommandWrapper.java:
##########
@@ -19,18 +19,41 @@
 
 package com.cloud.hypervisor.kvm.resource.wrapper;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.ReadyAnswer;
 import com.cloud.agent.api.ReadyCommand;
+import com.cloud.host.Host;
 import com.cloud.hypervisor.kvm.resource.LibvirtComputingResource;
 import com.cloud.resource.CommandWrapper;
 import com.cloud.resource.ResourceWrapper;
+import com.cloud.utils.script.Script;
+
+import org.apache.log4j.Logger;
 
 @ResourceWrapper(handles =  ReadyCommand.class)
 public final class LibvirtReadyCommandWrapper extends CommandWrapper<ReadyCommand, Answer, LibvirtComputingResource> {
 
+    private static final Logger s_logger = Logger.getLogger(LibvirtReadyCommandWrapper.class);
+
     @Override
     public Answer execute(final ReadyCommand command, final LibvirtComputingResource libvirtComputingResource) {
-        return new ReadyAnswer(command);
+        Map<String, String> hostDetails = new HashMap<String, String>();
+
+        if (hostSupportsUefi()) {
+            hostDetails.put(Host.HOST_UEFI_ENABLE, Boolean.TRUE.toString());
+        }
+
+        return new ReadyAnswer(command, hostDetails);
+    }
+
+    private boolean hostSupportsUefi() {
+        String cmd = "rpm -qa | grep -i ovmf";

Review Comment:
   cc @davidjumani @weizhouapache @DaanHoogland we may need to fix this as we support both EL and Ubuntu, rpm isn't installed by default on Ubuntu. Probably just check if /sys/firmware/efi using File::exists?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org