Skip to content

Commit 6125886

Browse files
authored
Set UefiCapabilty for all hypervisors in hostresponse (#6140)
1 parent 38a0ded commit 6125886

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

api/src/main/java/org/apache/cloudstack/api/response/HostResponse.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -533,13 +533,6 @@ public void setDetails(Map details) {
533533
detailsCopy.remove("username");
534534
detailsCopy.remove("password");
535535

536-
if (detailsCopy.containsKey(Host.HOST_UEFI_ENABLE)) {
537-
this.setUefiCapabilty(Boolean.parseBoolean((String) detailsCopy.get(Host.HOST_UEFI_ENABLE)));
538-
detailsCopy.remove(Host.HOST_UEFI_ENABLE);
539-
} else {
540-
this.setUefiCapabilty(new Boolean(false)); // in case of existing host which is not scanned for UEFI capability
541-
}
542-
543536
this.details = detailsCopy;
544537
}
545538

server/src/main/java/com/cloud/api/query/dao/HostJoinDaoImpl.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.EnumSet;
2424
import java.util.Iterator;
2525
import java.util.List;
26+
import java.util.Map;
2627
import java.util.Set;
2728

2829
import javax.inject.Inject;
@@ -230,10 +231,18 @@ public HostResponse newHostResponse(HostJoinVO host, EnumSet<HostDetails> detail
230231
}
231232
}
232233

234+
Map<String, String> hostDetails = hostDetailsDao.findDetails(host.getId());
235+
if (hostDetails != null) {
236+
if (hostDetails.containsKey(Host.HOST_UEFI_ENABLE)) {
237+
hostResponse.setUefiCapabilty(Boolean.parseBoolean((String) hostDetails.get(Host.HOST_UEFI_ENABLE)));
238+
} else {
239+
hostResponse.setUefiCapabilty(new Boolean(false));
240+
}
241+
}
233242
if (details.contains(HostDetails.all) && host.getHypervisorType() == Hypervisor.HypervisorType.KVM) {
234243
//only kvm has the requirement to return host details
235244
try {
236-
hostResponse.setDetails(hostDetailsDao.findDetails(host.getId()));
245+
hostResponse.setDetails(hostDetails);
237246
} catch (Exception e) {
238247
s_logger.debug("failed to get host details", e);
239248
}

0 commit comments

Comments
 (0)