mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
vmware: Fix for mapping guest OS type read from OVF to existing guest OS in C… (#4553)
* Fix for mapping guest OS type read from OVF to existing guest OS in CloudStack database while registering VMware template * Added unit tests to String Utils methods and updated the code * Updated the java doc section * Updated os description logic to keep equals ignore match with guest os display name
This commit is contained in:
parent
4617be4583
commit
b1ddd7c2e6
@ -167,8 +167,26 @@ public class DeployAsIsHelperImpl implements DeployAsIsHelper {
|
|||||||
hypervisor.toString(), minimumHypervisorVersion);
|
hypervisor.toString(), minimumHypervisorVersion);
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(guestOsMappings)) {
|
if (CollectionUtils.isNotEmpty(guestOsMappings)) {
|
||||||
|
Long guestOsId = null;
|
||||||
|
if (guestOsMappings.size() == 1) {
|
||||||
GuestOSHypervisorVO mapping = guestOsMappings.get(0);
|
GuestOSHypervisorVO mapping = guestOsMappings.get(0);
|
||||||
return mapping.getGuestOsId();
|
guestOsId = mapping.getGuestOsId();
|
||||||
|
} else {
|
||||||
|
if (!StringUtils.isEmpty(guestOsDescription)) {
|
||||||
|
for (GuestOSHypervisorVO guestOSHypervisorVO : guestOsMappings) {
|
||||||
|
GuestOSVO guestOSVO = guestOSDao.findById(guestOSHypervisorVO.getGuestOsId());
|
||||||
|
if (guestOsDescription.equalsIgnoreCase(guestOSVO.getDisplayName())) {
|
||||||
|
guestOsId = guestOSHypervisorVO.getGuestOsId();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (null == guestOsId) {
|
||||||
|
GuestOSHypervisorVO mapping = guestOsMappings.get(guestOsMappings.size()-1);
|
||||||
|
guestOsId = mapping.getGuestOsId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return guestOsId;
|
||||||
} else {
|
} else {
|
||||||
throw new CloudRuntimeException("Did not find a guest OS with type " + guestOsType);
|
throw new CloudRuntimeException("Did not find a guest OS with type " + guestOsType);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user