You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by li...@apache.org on 2013/11/10 19:09:06 UTC

git commit: updated refs/heads/master to a35425e

Updated Branches:
  refs/heads/master d5632189d -> a35425eec


CLOUDSTACK-5122. System VMs are getting recreated with old template after upgrading to 4.2.
In VMware during VM start the existing disk information is used to configure the VMs. So even if a new disk is created using the new template VM continues to use the old disk.
Once the old root disk is marked for destroy force expunge it and sync the new disk into the VM folder before VM start


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a35425ee
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a35425ee
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a35425ee

Branch: refs/heads/master
Commit: a35425eec6f4aa919e42940ff8b70e33c2018900
Parents: d563218
Author: Likitha Shetty <li...@citrix.com>
Authored: Sun Nov 10 23:31:56 2013 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Sun Nov 10 23:31:56 2013 +0530

----------------------------------------------------------------------
 .../engine/orchestration/VolumeOrchestrator.java          | 10 ++++++++++
 .../cloud/storage/resource/VmwareStorageProcessor.java    |  4 +---
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a35425ee/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 f839d6c..991e052 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -738,6 +738,16 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
                 } catch (NoTransitionException e) {
                     s_logger.debug("Unable to destroy existing volume: " + e.toString());
                 }
+                // In case of VMware VM will continue to use the old root disk until expunged, so force expunge old root disk
+                if (vm.getHypervisorType() == HypervisorType.VMware) {
+                    s_logger.info("Expunging volume " + existingVolume.getId() + " from primary data store");
+                    AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volFactory.getVolume(existingVolume.getId()));
+                    try {
+                        future.get();
+                    } catch (Exception e) {
+                        s_logger.debug("Failed to expunge volume:" + existingVolume.getId(), e);
+                    }
+                }
                 
                 return newVolume;
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a35425ee/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 fbbbc13..b31b926 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -383,9 +383,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
             // restoreVM - move the new ROOT disk into corresponding VM folder
             String vmInternalCSName = volume.getVmName();
             if (dsMo.folderExists(String.format("[%s]", dsMo.getName()), vmInternalCSName)) {
-                String oldRootDisk = VmwareStorageLayoutHelper.getVmwareDatastorePathFromVmdkFileName(dsMo, vmInternalCSName, vmdkName);
-                if (oldRootDisk != null)
-                    VmwareStorageLayoutHelper.syncVolumeToVmDefaultFolder(dcMo, vmInternalCSName, dsMo, vmdkName);
+                VmwareStorageLayoutHelper.syncVolumeToVmDefaultFolder(dcMo, vmInternalCSName, dsMo, vmdkName);
             }
 
             VolumeObjectTO newVol = new VolumeObjectTO();