Repository: cloudstack Updated Branches: refs/heads/master 4e5dc5921 -> 7dbff9b42
CLOUDSTACK-7371. [VMware] Enabling primary storage maintenance fails when storages are across cluster. 1. While destroying a ROOT volume do the lookup of the associated VM under the DC and not just cluster. 2. In case of VMware, during VM start if a volume is being recreated no need to detach the old volume because we now expunge it immediately and don't wait for the storage cleanup task to run. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7dbff9b4 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7dbff9b4 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7dbff9b4 Branch: refs/heads/master Commit: 7dbff9b42c9db17839715de21d142a5c077b6a6a Parents: 8bb4022 Author: Likitha Shetty <likitha.she...@citrix.com> Authored: Tue Aug 12 16:02:02 2014 +0530 Committer: Likitha Shetty <likitha.she...@citrix.com> Committed: Wed Aug 20 10:51:18 2014 +0530 ---------------------------------------------------------------------- .../cloudstack/engine/orchestration/VolumeOrchestrator.java | 6 ------ .../src/com/cloud/storage/resource/VmwareStorageProcessor.java | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7dbff9b4/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index 21b952f..afc6f63 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -799,12 +799,6 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati @Override public VolumeVO doInTransaction(TransactionStatus status) { VolumeVO newVolume = allocateDuplicateVolumeVO(existingVolume, templateIdToUseFinal); - // In case of Vmware if vm reference is not removed then during root - // disk cleanup - // the vm also gets deleted, so remove the reference - if (vm.getHypervisorType() == HypervisorType.VMware) { - _volsDao.detachVolume(existingVolume.getId()); - } try { stateTransitTo(existingVolume, Volume.Event.DestroyRequested); } catch (NoTransitionException e) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7dbff9b4/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java index 730ea1e..b225e39 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java +++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java @@ -1594,7 +1594,9 @@ public class VmwareStorageProcessor implements StorageProcessor { String vmName = vol.getVmName(); if (vmName != null) { - VirtualMachineMO vmMo = clusterMo.findVmOnHyperHost(vmName); + // Find VM under the datacenter and not just the cluster. + DatacenterMO dcMo = new DatacenterMO(context, morDc); + VirtualMachineMO vmMo = dcMo.findVm(vmName); if (vmMo != null) { if (s_logger.isInfoEnabled()) { s_logger.info("Destroy root volume and VM itself. vmName " + vmName);