itsayushpandey commented on code in PR #7712:
URL: https://github.com/apache/cloudstack/pull/7712#discussion_r1306728952
##########
server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java:
##########
@@ -1211,30 +1257,13 @@ public UserVmResponse
importUnmanagedInstance(ImportUnmanagedInstanceCmd cmd) {
throw new
ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Unable to
retrieve details for unmanaged VM: %s", name));
}
if
(template.getName().equals(VM_IMPORT_DEFAULT_TEMPLATE_NAME)) {
- String osName = unmanagedInstance.getOperatingSystem();
- GuestOS guestOS = null;
- if (StringUtils.isNotEmpty(osName)) {
- guestOS = guestOSDao.listByDisplayName(osName);
- }
- GuestOSHypervisor guestOSHypervisor = null;
- if (guestOS != null) {
- guestOSHypervisor =
guestOSHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(),
host.getHypervisorType().toString(), host.getHypervisorVersion());
- }
- if (guestOSHypervisor == null &&
StringUtils.isNotEmpty(unmanagedInstance.getOperatingSystemId())) {
- guestOSHypervisor =
guestOSHypervisorDao.findByOsNameAndHypervisor(unmanagedInstance.getOperatingSystemId(),
host.getHypervisorType().toString(), host.getHypervisorVersion());
- }
- if (guestOSHypervisor == null) {
- if (guestOS != null) {
- throw new
ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Unable to find
hypervisor guest OS ID: %s details for unmanaged VM: %s for hypervisor: %s
version: %s. templateid parameter can be used to assign template for VM",
guestOS.getUuid(), name, host.getHypervisorType().toString(),
host.getHypervisorVersion()));
- }
- throw new
ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Unable to
retrieve guest OS details for unmanaged VM: %s with OS name: %s, OS ID: %s for
hypervisor: %s version: %s. templateid parameter can be used to assign template
for VM", name, osName, unmanagedInstance.getOperatingSystemId(),
host.getHypervisorType().toString(), host.getHypervisorVersion()));
- }
-
template.setGuestOSId(guestOSHypervisor.getGuestOsId());
+ throw new InvalidParameterValueException("Template is
needed and unable to use default template for hypervisor " +
host.getHypervisorType().toString());
Review Comment:
Ah, thats true. Fixed the check for KVM only.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]