|
19 | 19 |
|
20 | 20 | package org.apache.cloudstack.storage.motion; |
21 | 21 |
|
22 | | -import java.util.HashMap; |
| 22 | +import java.util.ArrayList; |
23 | 23 | import java.util.List; |
24 | 24 | import java.util.Map; |
25 | 25 |
|
|
53 | 53 | import com.cloud.storage.StoragePool; |
54 | 54 | import com.cloud.storage.VolumeVO; |
55 | 55 | import com.cloud.storage.dao.VolumeDao; |
| 56 | +import com.cloud.utils.Pair; |
56 | 57 | import com.cloud.utils.exception.CloudRuntimeException; |
57 | 58 | import com.cloud.vm.VMInstanceVO; |
58 | 59 | import com.cloud.vm.dao.VMInstanceDao; |
@@ -130,12 +131,12 @@ private Answer migrateVmWithVolumesAcrossCluster(VMInstanceVO vm, VirtualMachine |
130 | 131 |
|
131 | 132 | // Initiate migration of a virtual machine with it's volumes. |
132 | 133 | try { |
133 | | - Map<VolumeTO, StorageFilerTO> volumeToFilerto = new HashMap<VolumeTO, StorageFilerTO>(); |
| 134 | + List<Pair<VolumeTO, StorageFilerTO>> volumeToFilerto = new ArrayList<Pair<VolumeTO, StorageFilerTO>>(); |
134 | 135 | for (Map.Entry<VolumeInfo, DataStore> entry : volumeToPool.entrySet()) { |
135 | 136 | VolumeInfo volume = entry.getKey(); |
136 | 137 | VolumeTO volumeTo = new VolumeTO(volume, storagePoolDao.findById(volume.getPoolId())); |
137 | 138 | StorageFilerTO filerTo = new StorageFilerTO((StoragePool)entry.getValue()); |
138 | | - volumeToFilerto.put(volumeTo, filerTo); |
| 139 | + volumeToFilerto.add(new Pair<VolumeTO, StorageFilerTO>(volumeTo, filerTo)); |
139 | 140 | } |
140 | 141 |
|
141 | 142 | // Migration across cluster needs to be done in three phases. |
@@ -168,12 +169,12 @@ private Answer migrateVmWithVolumesWithinCluster(VMInstanceVO vm, VirtualMachine |
168 | 169 |
|
169 | 170 | // Initiate migration of a virtual machine with it's volumes. |
170 | 171 | try { |
171 | | - Map<VolumeTO, StorageFilerTO> volumeToFilerto = new HashMap<VolumeTO, StorageFilerTO>(); |
| 172 | + List<Pair<VolumeTO, StorageFilerTO>> volumeToFilerto = new ArrayList<Pair<VolumeTO, StorageFilerTO>>(); |
172 | 173 | for (Map.Entry<VolumeInfo, DataStore> entry : volumeToPool.entrySet()) { |
173 | 174 | VolumeInfo volume = entry.getKey(); |
174 | 175 | VolumeTO volumeTo = new VolumeTO(volume, storagePoolDao.findById(volume.getPoolId())); |
175 | 176 | StorageFilerTO filerTo = new StorageFilerTO((StoragePool)entry.getValue()); |
176 | | - volumeToFilerto.put(volumeTo, filerTo); |
| 177 | + volumeToFilerto.add(new Pair<VolumeTO, StorageFilerTO>(volumeTo, filerTo)); |
177 | 178 | } |
178 | 179 |
|
179 | 180 | MigrateWithStorageCommand command = new MigrateWithStorageCommand(to, volumeToFilerto, destHost.getGuid()); |
|
0 commit comments