Skip to content

Commit 32cc1d4

Browse files
author
Rene Glover
authored
Copy on pool host when storage pool has ScopeType.HOST (#9356)
1 parent 5c365fa commit 32cc1d4

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
import com.cloud.storage.DataStoreRole;
104104
import com.cloud.storage.DiskOfferingVO;
105105
import com.cloud.storage.MigrationOptions;
106+
import com.cloud.storage.ScopeType;
106107
import com.cloud.storage.Snapshot;
107108
import com.cloud.storage.SnapshotVO;
108109
import com.cloud.storage.Storage;
@@ -921,11 +922,17 @@ private HostVO getHostOnWhichToExecuteMigrationCommand(VolumeInfo srcVolumeInfo,
921922

922923
HostVO hostVO;
923924

924-
if (srcStoragePoolVO.getClusterId() != null) {
925-
hostVO = getHostInCluster(srcStoragePoolVO.getClusterId());
926-
}
927-
else {
928-
hostVO = getHost(destVolumeInfo.getDataCenterId(), HypervisorType.KVM, false);
925+
// if either source or destination is a HOST-scoped storage pool, the migration MUST be performed on that host
926+
if (ScopeType.HOST.equals(srcVolumeInfo.getDataStore().getScope().getScopeType())) {
927+
hostVO = _hostDao.findById(srcVolumeInfo.getDataStore().getScope().getScopeId());
928+
} else if (ScopeType.HOST.equals(destVolumeInfo.getDataStore().getScope().getScopeType())) {
929+
hostVO = _hostDao.findById(destVolumeInfo.getDataStore().getScope().getScopeId());
930+
} else {
931+
if (srcStoragePoolVO.getClusterId() != null) {
932+
hostVO = getHostInCluster(srcStoragePoolVO.getClusterId());
933+
} else {
934+
hostVO = getHost(destVolumeInfo.getDataCenterId(), HypervisorType.KVM, false);
935+
}
929936
}
930937

931938
return hostVO;

0 commit comments

Comments
 (0)