You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/04/29 16:51:44 UTC
[6/6] git commit: updated refs/heads/4.5 to 031d7a9
CLOUDSTACK-8412. VM migration with storage fails.
Update MigrateWithStorageCommand to avoid JSON deserialization error.
(cherry picked from commit 04365601dac6d4dfa396e5c86ab7e698906dfb44)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/27b7e49b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/27b7e49b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/27b7e49b
Branch: refs/heads/4.5
Commit: 27b7e49b395d089ff45037faa51e73d979ceb62b
Parents: 6c649ce
Author: Likitha Shetty <li...@citrix.com>
Authored: Fri Apr 3 15:47:07 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Wed Apr 29 16:50:40 2015 +0200
----------------------------------------------------------------------
.../hypervisor/vmware/resource/VmwareResource.java | 12 ++++++------
.../storage/motion/VmwareStorageMotionStrategy.java | 11 ++++++-----
2 files changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/27b7e49b/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 9f90901..9e7db37 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -3036,7 +3036,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
List<VolumeObjectTO> volumeToList = new ArrayList<VolumeObjectTO>();
Map<Long, Integer> volumeDeviceKey = new HashMap<Long, Integer>();
- Map<VolumeTO, StorageFilerTO> volToFiler = cmd.getVolumeToFiler();
+ List<Pair<VolumeTO, StorageFilerTO>> volToFiler = cmd.getVolumeToFilerAsList();
String tgtHost = cmd.getTargetHost();
String tgtHostMorInfo = tgtHost.split("@")[0];
morTgtHost.setType(tgtHostMorInfo.split(":")[0]);
@@ -3064,9 +3064,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
vmName = vmMo.getName();
// Specify destination datastore location for each volume
- for (Entry<VolumeTO, StorageFilerTO> entry : volToFiler.entrySet()) {
- volume = entry.getKey();
- filerTo = entry.getValue();
+ for (Pair<VolumeTO, StorageFilerTO> entry : volToFiler) {
+ volume = entry.first();
+ filerTo = entry.second();
s_logger.debug("Preparing spec for volume : " + volume.getName());
morDsAtTarget = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(tgtHyperHost, filerTo.getUuid());
@@ -3195,8 +3195,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
}
// Update and return volume path for every disk because that could have changed after migration
- for (Entry<VolumeTO, StorageFilerTO> entry : volToFiler.entrySet()) {
- volume = entry.getKey();
+ for (Pair<VolumeTO, StorageFilerTO> entry : volToFiler) {
+ volume = entry.first();
long volumeId = volume.getId();
VirtualDisk[] disks = vmMo.getAllDiskDevice();
for (VirtualDisk disk : disks) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/27b7e49b/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 24efde7..da9764d 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
@@ -19,7 +19,7 @@
package org.apache.cloudstack.storage.motion;
-import java.util.HashMap;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -53,6 +53,7 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.StoragePool;
import com.cloud.storage.VolumeVO;
import com.cloud.storage.dao.VolumeDao;
+import com.cloud.utils.Pair;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.dao.VMInstanceDao;
@@ -130,12 +131,12 @@ public class VmwareStorageMotionStrategy implements DataMotionStrategy {
// Initiate migration of a virtual machine with it's volumes.
try {
- Map<VolumeTO, StorageFilerTO> volumeToFilerto = new HashMap<VolumeTO, StorageFilerTO>();
+ List<Pair<VolumeTO, StorageFilerTO>> volumeToFilerto = new ArrayList<Pair<VolumeTO, StorageFilerTO>>();
for (Map.Entry<VolumeInfo, DataStore> entry : volumeToPool.entrySet()) {
VolumeInfo volume = entry.getKey();
VolumeTO volumeTo = new VolumeTO(volume, storagePoolDao.findById(volume.getPoolId()));
StorageFilerTO filerTo = new StorageFilerTO((StoragePool)entry.getValue());
- volumeToFilerto.put(volumeTo, filerTo);
+ volumeToFilerto.add(new Pair<VolumeTO, StorageFilerTO>(volumeTo, filerTo));
}
// Migration across cluster needs to be done in three phases.
@@ -168,12 +169,12 @@ public class VmwareStorageMotionStrategy implements DataMotionStrategy {
// Initiate migration of a virtual machine with it's volumes.
try {
- Map<VolumeTO, StorageFilerTO> volumeToFilerto = new HashMap<VolumeTO, StorageFilerTO>();
+ List<Pair<VolumeTO, StorageFilerTO>> volumeToFilerto = new ArrayList<Pair<VolumeTO, StorageFilerTO>>();
for (Map.Entry<VolumeInfo, DataStore> entry : volumeToPool.entrySet()) {
VolumeInfo volume = entry.getKey();
VolumeTO volumeTo = new VolumeTO(volume, storagePoolDao.findById(volume.getPoolId()));
StorageFilerTO filerTo = new StorageFilerTO((StoragePool)entry.getValue());
- volumeToFilerto.put(volumeTo, filerTo);
+ volumeToFilerto.add(new Pair<VolumeTO, StorageFilerTO>(volumeTo, filerTo));
}
MigrateWithStorageCommand command = new MigrateWithStorageCommand(to, volumeToFilerto, destHost.getGuid());