Github user pedro-martins commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/797#discussion_r53579417 --- Diff: engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java --- @@ -1776,19 +1773,26 @@ private void orchestrateStorageMigration(final String vmUuid, final StoragePool // If VM was cold migrated between clusters belonging to two different VMware DCs, // unregister the VM from the source host and cleanup the associated VM files. if (vm.getHypervisorType().equals(HypervisorType.VMware)) { + Long srcClusterId = null; + Long srcHostId = vm.getHostId() != null ? vm.getHostId() : vm.getLastHostId(); + if (srcHostId != null) { + HostVO srcHost = _hostDao.findById(srcHostId); + srcClusterId = srcHost.getClusterId(); + } + final Long destClusterId = destPool.getClusterId(); if (srcClusterId != null && destClusterId != null && ! srcClusterId.equals(destClusterId)) { final String srcDcName = _clusterDetailsDao.getVmwareDcName(srcClusterId); final String destDcName = _clusterDetailsDao.getVmwareDcName(destClusterId); if (srcDcName != null && destDcName != null && !srcDcName.equals(destDcName)) { s_logger.debug("Since VM's storage was successfully migrated across VMware Datacenters, unregistering VM: " + vm.getInstanceName() + - " from source host: " + srcHost.getId()); + " from source host: " + srcHostId); final UnregisterVMCommand uvc = new UnregisterVMCommand(vm.getInstanceName()); uvc.setCleanupVmFiles(true); try { - _agentMgr.send(srcHost.getId(), uvc); + _agentMgr.send(srcHostId, uvc); } catch (final Exception e) { - throw new CloudRuntimeException("Failed to unregister VM: " + vm.getInstanceName() + " from source host: " + srcHost.getId() + + throw new CloudRuntimeException("Failed to unregister VM: " + vm.getInstanceName() + " from source host: " + srcHostId + --- End diff -- hi @maneesha-p How about you replace the catch Exception at line 1794 to ( AgentUnavailableException | OperationTimedoutException )?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---