sureshanaparti commented on code in PR #9787:
URL: https://github.com/apache/cloudstack/pull/9787#discussion_r1802980247


##########
server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java:
##########
@@ -1781,18 +1788,54 @@ private Map<String, String> 
createParamsForRemoveClonedInstance(String vcenter,
         return params;
     }
 
-    private HostVO selectInstanceConversionKVMHostInCluster(Cluster 
destinationCluster, Long convertInstanceHostId) {
+    private HostVO selectKVMHostForImportingInCluster(Cluster 
destinationCluster, Long importInstanceHostId) {
+        if (importInstanceHostId != null) {
+            HostVO selectedHost = hostDao.findById(importInstanceHostId);
+            if (selectedHost == null) {
+                String msg = String.format("Cannot find host with ID %s", 
importInstanceHostId);
+                LOGGER.error(msg);
+                throw new CloudRuntimeException(msg);
+            }
+            if (selectedHost.getResourceState() != ResourceState.Enabled ||
+                    selectedHost.getStatus() != Status.Up || 
selectedHost.getType() != Host.Type.Routing ||
+                    destinationCluster.getDataCenterId() != 
selectedHost.getDataCenterId() ||
+                    selectedHost.getClusterId() != destinationCluster.getId()

Review Comment:
   maybe, different check and error message for not valid datacenter & cluster



-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to