|
44 | 44 | import com.cloud.exception.NetworkRuleConflictException; |
45 | 45 | import com.cloud.exception.ResourceUnavailableException; |
46 | 46 | import com.cloud.exception.VirtualMachineMigrationException; |
47 | | -import com.cloud.hypervisor.Hypervisor; |
48 | 47 | import com.cloud.kubernetes.cluster.KubernetesCluster; |
49 | 48 | import com.cloud.kubernetes.cluster.KubernetesClusterManagerImpl; |
50 | 49 | import com.cloud.kubernetes.cluster.KubernetesClusterService; |
|
61 | 60 | import com.cloud.utils.exception.CloudRuntimeException; |
62 | 61 | import com.cloud.utils.ssh.SshHelper; |
63 | 62 | import com.cloud.vm.UserVmVO; |
64 | | -import com.cloud.vm.VMInstanceVO; |
65 | | -import com.cloud.vm.VirtualMachine; |
66 | 63 | import org.apache.logging.log4j.Level; |
67 | 64 |
|
68 | 65 | import static com.cloud.kubernetes.cluster.KubernetesServiceHelper.KubernetesClusterNodeType.CONTROL; |
@@ -310,18 +307,8 @@ private void validateKubernetesClusterScaleOfferingParameters() throws CloudRunt |
310 | 307 | } |
311 | 308 | final long originalNodeCount = kubernetesCluster.getTotalNodeCount(); |
312 | 309 | List<KubernetesClusterVmMapVO> vmList = kubernetesClusterVmMapDao.listByClusterId(kubernetesCluster.getId()); |
313 | | - if (vmList == null || vmList.isEmpty() || vmList.size() < originalNodeCount) { |
| 310 | + if (CollectionUtils.isEmpty(vmList) || vmList.size() < originalNodeCount) { |
314 | 311 | logTransitStateToFailedIfNeededAndThrow(Level.WARN, String.format("Scaling Kubernetes cluster : %s failed, it is in unstable state as not enough existing VM instances found!", kubernetesCluster.getName())); |
315 | | - } else { |
316 | | - for (KubernetesClusterVmMapVO vmMapVO : vmList) { |
317 | | - VMInstanceVO vmInstance = vmInstanceDao.findById(vmMapVO.getVmId()); |
318 | | - if (vmInstance != null && vmInstance.getState().equals(VirtualMachine.State.Running) && |
319 | | - vmInstance.getHypervisorType() != Hypervisor.HypervisorType.XenServer && |
320 | | - vmInstance.getHypervisorType() != Hypervisor.HypervisorType.VMware && |
321 | | - vmInstance.getHypervisorType() != Hypervisor.HypervisorType.Simulator) { |
322 | | - logTransitStateToFailedIfNeededAndThrow(Level.WARN, String.format("Scaling Kubernetes cluster : %s failed, scaling Kubernetes cluster with running VMs on hypervisor %s is not supported!", kubernetesCluster.getName(), vmInstance.getHypervisorType())); |
323 | | - } |
324 | | - } |
325 | 312 | } |
326 | 313 | } |
327 | 314 |
|
|
0 commit comments