Skip to content

Commit 458264a

Browse files
CLOUDSTACK-9353: [XenServer] Fixed VM migration with storage
1 parent 9275ba2 commit 458264a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xen610/XenServer610MigrateWithStorageCommandWrapper.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.Map;
2525
import java.util.Set;
2626

27+
import com.cloud.utils.Pair;
2728
import org.apache.cloudstack.storage.to.VolumeObjectTO;
2829
import org.apache.log4j.Logger;
2930

@@ -60,7 +61,7 @@ public final class XenServer610MigrateWithStorageCommandWrapper extends CommandW
6061
public Answer execute(final MigrateWithStorageCommand command, final XenServer610Resource xenServer610Resource) {
6162
final Connection connection = xenServer610Resource.getConnection();
6263
final VirtualMachineTO vmSpec = command.getVirtualMachine();
63-
final Map<VolumeTO, StorageFilerTO> volumeToFiler = command.getVolumeToFiler();
64+
final List<Pair<VolumeTO, StorageFilerTO>> volumeToFiler = command.getVolumeToFilerAsList();
6465
final String vmName = vmSpec.getName();
6566
Task task = null;
6667

@@ -80,13 +81,14 @@ public Answer execute(final MigrateWithStorageCommand command, final XenServer61
8081
final XsLocalNetwork nativeNetworkForTraffic = xenServer610Resource.getNativeNetworkForTraffic(connection, TrafficType.Storage, null);
8182
final Network networkForSm = nativeNetworkForTraffic.getNetwork();
8283

83-
// Create the vif map. The vm stays in the same cluster so we have to pass an empty vif map.
84+
// Create the vif map. The vm stays in the same cluster so we have to pass an empty vif map.
8485
final Map<VIF, Network> vifMap = new HashMap<VIF, Network>();
8586
final Map<VDI, SR> vdiMap = new HashMap<VDI, SR>();
86-
for (final Map.Entry<VolumeTO, StorageFilerTO> entry : volumeToFiler.entrySet()) {
87-
final VolumeTO volume = entry.getKey();
88-
final StorageFilerTO sotrageFiler = entry.getValue();
89-
vdiMap.put(xenServer610Resource.getVDIbyUuid(connection, volume.getPath()), xenServer610Resource.getStorageRepository(connection, sotrageFiler.getUuid()));
87+
88+
for (final Pair<VolumeTO, StorageFilerTO> entry : volumeToFiler) {
89+
final StorageFilerTO storageFiler = entry.second();
90+
final VolumeTO volume = entry.first();
91+
vdiMap.put(xenServer610Resource.getVDIbyUuid(connection, volume.getPath()), xenServer610Resource.getStorageRepository(connection, storageFiler.getUuid()));
9092
}
9193

9294
// Get the vm to migrate.

0 commit comments

Comments
 (0)