cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject git commit: updated refs/heads/master to f499281
Date Wed, 26 Aug 2015 09:46:11 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master cb50d1d82 -> f49928162


CLOUDSTACK-8602. MigrateVirtualMachineWithVolume leaves old chain data for volume. Update
chain info of a volume after migration.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #548


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

Branch: refs/heads/master
Commit: f499281625f54ceb00aa44c3b499ad7f90d1db44
Parents: cb50d1d
Author: Likitha Shetty <likitha.shetty@citrix.com>
Authored: Sat Apr 18 00:03:26 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Wed Aug 26 15:15:53 2015 +0530

----------------------------------------------------------------------
 .../agent/api/storage/MigrateVolumeAnswer.java    |  9 +++++++++
 .../storage/motion/AncientDataMotionStrategy.java |  4 ++++
 .../vmware/resource/VmwareResource.java           | 18 +++++++++++++-----
 .../motion/VmwareStorageMotionStrategy.java       |  3 +++
 4 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4992816/core/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java b/core/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java
index 3db3e86..5e7200a 100644
--- a/core/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java
+++ b/core/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java
@@ -24,6 +24,7 @@ import com.cloud.agent.api.Command;
 
 public class MigrateVolumeAnswer extends Answer {
     private String volumePath;
+    private String volumeChain;
 
     public MigrateVolumeAnswer(Command command, boolean success, String details, String volumePath)
{
         super(command, success, details);
@@ -38,4 +39,12 @@ public class MigrateVolumeAnswer extends Answer {
     public String getVolumePath() {
         return volumePath;
     }
+
+    public void setVolumeChainInfo(String chainInfo) {
+        this.volumeChain = chainInfo;
+    }
+
+    public String getVolumeChainInfo() {
+        return volumeChain;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4992816/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
index 84df7ff..24ecff5 100644
--- a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
+++ b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
@@ -407,6 +407,10 @@ public class AncientDataMotionStrategy implements DataMotionStrategy
{
             VolumeVO volumeVo = volDao.findById(volume.getId());
             Long oldPoolId = volume.getPoolId();
             volumeVo.setPath(((MigrateVolumeAnswer)answer).getVolumePath());
+            String chainInfo = ((MigrateVolumeAnswer)answer).getVolumeChainInfo();
+            if (chainInfo != null) {
+                volumeVo.setChainInfo(chainInfo);
+            }
             volumeVo.setPodId(destPool.getPodId());
             volumeVo.setPoolId(destPool.getId());
             volumeVo.setLastPoolId(oldPoolId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4992816/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index e13ad78..da97cdd 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -3203,7 +3203,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                 s_logger.debug("Successfully consolidated disks of VM " + vmName + ".");
             }
 
-            // Update and return volume path for every disk because that could have changed
after migration
+            // Update and return volume path and chain info for every disk because that could
have changed after migration
+            VirtualMachineDiskInfoBuilder diskInfoBuilder = vmMo.getDiskInfoBuilder();
             for (Pair<VolumeTO, StorageFilerTO> entry : volToFiler) {
                 volume = entry.first();
                 long volumeId = volume.getId();
@@ -3211,8 +3212,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                 for (VirtualDisk disk : disks) {
                     if (volumeDeviceKey.get(volumeId) == disk.getKey()) {
                         VolumeObjectTO newVol = new VolumeObjectTO();
+                        String newPath = vmMo.getVmdkFileBaseName(disk);
+                        String poolName = entry.second().getUuid().replace("-", "");
+                        VirtualMachineDiskInfo diskInfo = diskInfoBuilder.getDiskInfoByBackingFileBaseName(newPath,
poolName);
                         newVol.setId(volumeId);
-                        newVol.setPath(vmMo.getVmdkFileBaseName(disk));
+                        newVol.setPath(newPath);
+                        newVol.setChainInfo(_gson.toJson(diskInfo));
                         volumeToList.add(newVol);
                         break;
                     }
@@ -3329,7 +3334,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                 s_logger.debug("Successfully consolidated disks of VM " + vmName + ".");
             }
 
-            // Update and return volume path because that could have changed after migration
+            // Update and return volume path and chain info because that could have changed
after migration
             if (!targetDsMo.fileExists(fullVolumePath)) {
                 VirtualDisk[] disks = vmMo.getAllDiskDevice();
                 for (VirtualDisk disk : disks)
@@ -3337,8 +3342,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                         volumePath = vmMo.getVmdkFileBaseName(disk);
                     }
             }
-
-            return new MigrateVolumeAnswer(cmd, true, null, volumePath);
+            VirtualMachineDiskInfoBuilder diskInfoBuilder = vmMo.getDiskInfoBuilder();
+            String chainInfo = _gson.toJson(diskInfoBuilder.getDiskInfoByBackingFileBaseName(volumePath,
poolTo.getUuid().replace("-", "")));
+            MigrateVolumeAnswer answer = new MigrateVolumeAnswer(cmd, true, null, volumePath);
+            answer.setVolumeChainInfo(chainInfo);
+            return answer;
         } catch (Exception e) {
             String msg = "Catch Exception " + e.getClass().getName() + " due to " + e.toString();
             s_logger.error(msg, e);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4992816/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java
b/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java
index da9764d..4b77aab 100644
--- a/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java
+++ b/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java
@@ -207,6 +207,9 @@ public class VmwareStorageMotionStrategy implements DataMotionStrategy
{
                     VolumeVO volumeVO = volDao.findById(volume.getId());
                     Long oldPoolId = volumeVO.getPoolId();
                     volumeVO.setPath(volumeTo.getPath());
+                    if (volumeTo.getChainInfo() != null) {
+                        volumeVO.setChainInfo(volumeTo.getChainInfo());
+                    }
                     volumeVO.setLastPoolId(oldPoolId);
                     volumeVO.setFolder(pool.getPath());
                     volumeVO.setPodId(pool.getPodId());


Mime
View raw message