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


##########
server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java:
##########
@@ -1781,20 +1788,77 @@ private Map<String, String> 
createParamsForRemoveClonedInstance(String vcenter,
         return params;
     }
 
-    private HostVO selectInstanceConversionKVMHostInCluster(Cluster 
destinationCluster, Long convertInstanceHostId) {
+    HostVO selectKVMHostForImportingInCluster(Cluster destinationCluster, Long 
importInstanceHostId) {
+        if (importInstanceHostId != null) {
+            String err = null;
+            HostVO selectedHost = hostDao.findById(importInstanceHostId);
+            if (selectedHost == null) {
+                err = String.format("Cannot find host with ID %s to import the 
instance",
+                        importInstanceHostId);
+            } else if (selectedHost.getResourceState() != 
ResourceState.Enabled) {
+                err = String.format(
+                        "Cannot import the converted instance on the host %s 
as it is not in Enabled state",
+                        selectedHost.getName());
+            } else if (selectedHost.getStatus() != Status.Up) {
+                err = String.format(
+                        "Cannot import the converted instance on the host %s 
as it is not running",
+                        selectedHost.getName());
+            } else if (selectedHost.getType() != Host.Type.Routing) {
+                err = String.format(
+                        "Cannot import the converted instance on the host %s 
as it is not a routing host",
+                        selectedHost.getName());
+            } else if (destinationCluster.getId() != 
selectedHost.getClusterId()) {
+                err = String.format(
+                        "Cannot import the converted instance on the host %s 
as it is not in the same zone as the destination cluster",

Review Comment:
   ```suggestion
                           "Cannot import the converted instance on the host %s 
as it is not in the same cluster as the destination 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