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 18:43:38 UTC

git commit: updated refs/heads/4.2 to 42941b3

Updated Branches:
  refs/heads/4.2 6d8dbd5a7 -> 42941b337


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/42941b33
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/42941b33
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/42941b33

Branch: refs/heads/4.2
Commit: 42941b3376dae903bf512f24dc3d77c06de3feb4
Parents: 6d8dbd5
Author: Likitha Shetty <li...@citrix.com>
Authored: Sun Nov 10 22:41:06 2013 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Sun Nov 10 23:05:37 2013 +0530

----------------------------------------------------------------------
 .../cloud/storage/resource/VmwareStorageProcessor.java    |  2 --
 server/src/com/cloud/storage/VolumeManagerImpl.java       | 10 ++++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/42941b33/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 3b661e9..9538176 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -397,8 +397,6 @@ 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);
             }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/42941b33/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java
index faa4ed3..31b52ca 100644
--- a/server/src/com/cloud/storage/VolumeManagerImpl.java
+++ b/server/src/com/cloud/storage/VolumeManagerImpl.java
@@ -2133,6 +2133,16 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         } 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);
+            }
+        }
         txn.commit();
         return newVolume;