Set UefiCapabilty for all hypervisors in hostresponse (#6140)

This commit is contained in:
David Jumani 2022-03-21 23:43:03 +05:30 committed by GitHub
parent 38a0ded053
commit 6125886f3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -533,13 +533,6 @@ public class HostResponse extends BaseResponseWithAnnotations {
detailsCopy.remove("username");
detailsCopy.remove("password");
if (detailsCopy.containsKey(Host.HOST_UEFI_ENABLE)) {
this.setUefiCapabilty(Boolean.parseBoolean((String) detailsCopy.get(Host.HOST_UEFI_ENABLE)));
detailsCopy.remove(Host.HOST_UEFI_ENABLE);
} else {
this.setUefiCapabilty(new Boolean(false)); // in case of existing host which is not scanned for UEFI capability
}
this.details = detailsCopy;
}

View File

@ -23,6 +23,7 @@ import java.util.Date;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.inject.Inject;
@ -230,10 +231,18 @@ public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements
}
}
Map<String, String> hostDetails = hostDetailsDao.findDetails(host.getId());
if (hostDetails != null) {
if (hostDetails.containsKey(Host.HOST_UEFI_ENABLE)) {
hostResponse.setUefiCapabilty(Boolean.parseBoolean((String) hostDetails.get(Host.HOST_UEFI_ENABLE)));
} else {
hostResponse.setUefiCapabilty(new Boolean(false));
}
}
if (details.contains(HostDetails.all) && host.getHypervisorType() == Hypervisor.HypervisorType.KVM) {
//only kvm has the requirement to return host details
try {
hostResponse.setDetails(hostDetailsDao.findDetails(host.getId()));
hostResponse.setDetails(hostDetails);
} catch (Exception e) {
s_logger.debug("failed to get host details", e);
}