Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

import org.apache.cloudstack.storage.to.VolumeObjectTO;

import com.cloud.utils.Pair;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.MigrateWithStorageAnswer;
Expand Down Expand Up @@ -126,7 +127,7 @@ private List<VolumeObjectTO> getUpdatedVolumePathsOfMigratedVm(Connection connec
protected MigrateWithStorageAnswer execute(MigrateWithStorageCommand cmd) {
Connection connection = getConnection();
VirtualMachineTO vmSpec = cmd.getVirtualMachine();
Map<VolumeTO, StorageFilerTO> volumeToFiler = cmd.getVolumeToFiler();
List<Pair<VolumeTO, StorageFilerTO>> volToFiler = cmd.getVolumeToFilerAsList();
final String vmName = vmSpec.getName();
Task task = null;

Expand All @@ -151,8 +152,8 @@ protected MigrateWithStorageAnswer execute(MigrateWithStorageCommand cmd) {
// Create the vif map. The vm stays in the same cluster so we have to pass an empty vif map.
Map<VIF, Network> vifMap = new HashMap<VIF, Network>();
Map<VDI, SR> vdiMap = new HashMap<VDI, SR>();
for (Map.Entry<VolumeTO, StorageFilerTO> entry : volumeToFiler.entrySet()) {
vdiMap.put(getVDIbyUuid(connection, entry.getKey().getPath()), getStorageRepository(connection, entry.getValue().getUuid()));
for (Pair<VolumeTO, StorageFilerTO> entry : volToFiler) {
vdiMap.put(getVDIbyUuid(connection, entry.first().getPath()), getStorageRepository(connection, entry.second().getUuid()));
}

// Check migration with storage is possible.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.cloudstack.storage.motion;

import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -55,6 +56,7 @@
import com.cloud.exception.OperationTimedoutException;
import com.cloud.host.Host;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.utils.Pair;
import com.cloud.storage.StoragePool;
import com.cloud.storage.VolumeVO;
import com.cloud.storage.dao.VolumeDao;
Expand Down Expand Up @@ -193,15 +195,15 @@ private Answer migrateVmWithVolumesWithinCluster(VMInstanceVO vm, VirtualMachine

// 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);
MigrateWithStorageCommand command = new MigrateWithStorageCommand(to, volumeToFilerto,destHost.getGuid());
MigrateWithStorageAnswer answer = (MigrateWithStorageAnswer)agentMgr.send(destHost.getId(), command);
if (answer == null) {
s_logger.error("Migration with storage of vm " + vm + " failed.");
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.