cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [33/50] [abbrv] git commit: updated refs/heads/object_store_migration to 5ec2a44
Date Tue, 29 Oct 2013 03:53:23 GMT
CLOUDSTACK-4946. VM Restore with template id/Volatile VM feature doesnt work on VMware
When a ROOT volume is created from base template, if a folder already exists for the ROOT
volume's VM then replace the old ROOT disk files with the new one.


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

Branch: refs/heads/object_store_migration
Commit: 7116268f33a5576f2eb80dffc921918021fd510f
Parents: 03830c5
Author: Likitha Shetty <likitha.shetty@citrix.com>
Authored: Fri Oct 25 15:39:33 2013 +0530
Committer: Likitha Shetty <likitha.shetty@citrix.com>
Committed: Mon Oct 28 13:17:54 2013 +0530

----------------------------------------------------------------------
 .../resource/VmwareStorageProcessor.java        | 21 +++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7116268f/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 53bd144..71ba4e9 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -345,11 +345,6 @@ public class VmwareStorageProcessor implements StorageProcessor {
                         vmMo.createDisk(volumeDatastorePath, (int) (volume.getSize() / (1024L
* 1024L)), morDatastore, -1);
                         vmMo.detachDisk(volumeDatastorePath, false);
                     }
-
-                    VolumeObjectTO newVol = new VolumeObjectTO();
-                    newVol.setPath(vmdkName);
-                    newVol.setSize(volume.getSize());
-                    return new CopyCmdAnswer(newVol);
                 } finally {
                     vmMo.detachAllDisks();
 
@@ -383,11 +378,19 @@ public class VmwareStorageProcessor implements StorageProcessor {
 
                 String srcFile = dsMo.getDatastorePath(vmdkName, true);
                 dsMo.deleteFile(srcFile, dcMo.getMor(), true);
-                VolumeObjectTO newVol = new VolumeObjectTO();
-                newVol.setPath(vmdkName);
-                newVol.setSize(volume.getSize());
-                return new CopyCmdAnswer(newVol);
             }
+            // 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);
+            }
+
+            VolumeObjectTO newVol = new VolumeObjectTO();
+            newVol.setPath(vmdkName);
+            newVol.setSize(volume.getSize());
+            return new CopyCmdAnswer(newVol);
         } catch (Throwable e) {
             if (e instanceof RemoteException) {
                 s_logger.warn("Encounter remote exception to vCenter, invalidate VMware session
context");


Mime
View raw message