-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix for mapping guest OS type read from OVF to existing guest OS in C… #4553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7c79723
f72f2fd
c1a9f41
4b8adeb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -167,8 +167,26 @@ public Long retrieveTemplateGuestOsIdFromGuestOsInfo(long templateId, String gue | |
| hypervisor.toString(), minimumHypervisorVersion); | ||
|
|
||
| if (CollectionUtils.isNotEmpty(guestOsMappings)) { | ||
| GuestOSHypervisorVO mapping = guestOsMappings.get(0); | ||
| return mapping.getGuestOsId(); | ||
| Long guestOsId = null; | ||
| if (guestOsMappings.size() == 1) { | ||
| GuestOSHypervisorVO mapping = guestOsMappings.get(0); | ||
| 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) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor nit - I think variable == null maybe more readable, but as I said that's not picking
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. depends on how accustomed you are in right to left reading ;)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. making habit of this to avoid setting null to the variable by mistake, in that case IDE also don't know if it is logically wrong "if (guestOsId = null)" :p |
||
| GuestOSHypervisorVO mapping = guestOsMappings.get(guestOsMappings.size()-1); | ||
| guestOsId = mapping.getGuestOsId(); | ||
| } | ||
| } | ||
| return guestOsId; | ||
| } else { | ||
| throw new CloudRuntimeException("Did not find a guest OS with type " + guestOsType); | ||
| } | ||
|
|
@@ -301,7 +319,7 @@ private void persistTemplateDeployAsIsInformationTOList(long templateId, | |
| } | ||
| String propValue = null; | ||
| try { | ||
| propValue = getValueFromInformationTO(informationTO); | ||
| propValue = getValueFromInformationTO(informationTO); | ||
| } catch (RuntimeException re) { | ||
| LOGGER.error("gson marshalling of property object fails: " + propKey,re); | ||
| } catch (IOException e) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.