Skip to content
Merged
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 @@ -103,6 +103,7 @@
import com.cloud.storage.DataStoreRole;
import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.MigrationOptions;
import com.cloud.storage.ScopeType;
import com.cloud.storage.Snapshot;
import com.cloud.storage.SnapshotVO;
import com.cloud.storage.Storage;
Expand Down Expand Up @@ -921,11 +922,17 @@ private HostVO getHostOnWhichToExecuteMigrationCommand(VolumeInfo srcVolumeInfo,

HostVO hostVO;

if (srcStoragePoolVO.getClusterId() != null) {
hostVO = getHostInCluster(srcStoragePoolVO.getClusterId());
}
else {
hostVO = getHost(destVolumeInfo.getDataCenterId(), HypervisorType.KVM, false);
// if either source or destination is a HOST-scoped storage pool, the migration MUST be performed on that host
if (ScopeType.HOST.equals(srcVolumeInfo.getDataStore().getScope().getScopeType())) {
hostVO = _hostDao.findById(srcVolumeInfo.getDataStore().getScope().getScopeId());
} else if (ScopeType.HOST.equals(destVolumeInfo.getDataStore().getScope().getScopeType())) {
hostVO = _hostDao.findById(destVolumeInfo.getDataStore().getScope().getScopeId());
} else {
if (srcStoragePoolVO.getClusterId() != null) {
hostVO = getHostInCluster(srcStoragePoolVO.getClusterId());
} else {
hostVO = getHost(destVolumeInfo.getDataCenterId(), HypervisorType.KVM, false);
}
}

return hostVO;
Expand Down