shwstppr commented on a change in pull request #4758:
URL: https://github.com/apache/cloudstack/pull/4758#discussion_r613802095
##########
File path:
engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
##########
@@ -2294,43 +2294,6 @@ private void markVolumesInPool(VMInstanceVO vm,
StoragePool destPool, Answer[] h
}
}
- private Pair<Long, Long> findClusterAndHostIdForVm(VMInstanceVO vm) {
- Long hostId = vm.getHostId();
- Long clusterId = null;
- // OfflineVmwareMigration: probably this is null when vm is stopped
- if(hostId == null) {
- hostId = vm.getLastHostId();
- if (s_logger.isDebugEnabled()) {
- s_logger.debug(String.format("host id is null, using last host
id %d", hostId) );
- }
- }
- if (hostId == null) {
- List<VolumeVO> volumes =
_volsDao.findByInstanceAndType(vm.getId(), Type.ROOT);
- if (CollectionUtils.isNotEmpty(volumes)) {
- for (VolumeVO rootVolume : volumes) {
- if (rootVolume.getPoolId() != null) {
- StoragePoolVO pool =
_storagePoolDao.findById(rootVolume.getPoolId());
- if (pool != null && pool.getClusterId() != null) {
- clusterId = pool.getClusterId();
- List<HostVO> hosts =
_hostDao.findHypervisorHostInCluster(pool.getClusterId());
- if (CollectionUtils.isNotEmpty(hosts)) {
- hostId = hosts.get(0).getId();
- break;
- }
- }
- }
- }
- }
- }
- if (clusterId == null && hostId != null) {
- HostVO host = _hostDao.findById(hostId);
- if (host != null) {
- clusterId = host.getClusterId();
- }
- }
- return new Pair<>(clusterId, hostId);
- }
-
private void migrateThroughHypervisorOrStorage(StoragePool destPool,
VMInstanceVO vm) throws StorageUnavailableException,
InsufficientCapacityException {
final VirtualMachineProfile profile = new
VirtualMachineProfileImpl(vm);
Pair<Long, Long> vmClusterAndHost = findClusterAndHostIdForVm(vm);
Review comment:
Uses private method
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]