use of org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority in project cloudstack by apache.
the class KvmNonManagedStorageSystemDataMotionTest method canHandleKVMLiveStorageMigrationInterCluster.
@Test
public void canHandleKVMLiveStorageMigrationInterCluster() {
when(host2.getClusterId()).thenReturn(5L);
StrategyPriority priority = kvmNonManagedStorageDataMotionStrategy.canHandleKVMNonManagedLiveNFSStorageMigration(migrationMap, host1, host2);
assertEquals(StrategyPriority.CANT_HANDLE, priority);
}
use of org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority in project cloudstack by apache.
the class KvmNonManagedStorageSystemDataMotionTest method internalCanHandleTestNonManaged.
@Test
public void internalCanHandleTestNonManaged() {
StoragePoolType[] storagePoolTypeArray = StoragePoolType.values();
for (int i = 0; i < storagePoolTypeArray.length; i++) {
Map<VolumeInfo, DataStore> volumeMap = configureTestInternalCanHandle(false, storagePoolTypeArray[i]);
StrategyPriority strategyPriority = kvmNonManagedStorageDataMotionStrategy.internalCanHandle(volumeMap, new HostVO("sourceHostUuid"), new HostVO("destHostUuid"));
if (supportStoragePoolType(storagePoolTypeArray[i])) {
Assert.assertEquals(StrategyPriority.HYPERVISOR, strategyPriority);
} else {
Assert.assertEquals(StrategyPriority.CANT_HANDLE, strategyPriority);
}
}
}
use of org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority in project cloudstack by apache.
the class KvmNonManagedStorageSystemDataMotionTest method testCanHandleLiveMigrationUnmanagedStorage.
@Test
public void testCanHandleLiveMigrationUnmanagedStorage() {
lenient().when(pool2.isManaged()).thenReturn(false);
StrategyPriority priority = kvmNonManagedStorageDataMotionStrategy.canHandleKVMNonManagedLiveNFSStorageMigration(migrationMap, host1, host2);
assertEquals(StrategyPriority.HYPERVISOR, priority);
}
use of org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority in project cloudstack by apache.
the class CephSnapshotStrategyTest method configureAndVerifyCanHandle.
private void configureAndVerifyCanHandle(Date removed, boolean isSnapshotStoredOnRbdStoragePool) {
Snapshot snapshot = Mockito.mock(Snapshot.class);
SnapshotOperation[] snapshotOps = SnapshotOperation.values();
Mockito.when(snapshot.getVolumeId()).thenReturn(0l);
VolumeVO volumeVO = Mockito.mock(VolumeVO.class);
Mockito.when(volumeVO.getRemoved()).thenReturn(removed);
Mockito.when(volumeDao.findByIdIncludingRemoved(Mockito.anyLong())).thenReturn(volumeVO);
Mockito.lenient().doReturn(isSnapshotStoredOnRbdStoragePool).when(cephSnapshotStrategy).isSnapshotStoredOnRbdStoragePool(Mockito.any());
for (int i = 0; i < snapshotOps.length - 1; i++) {
StrategyPriority strategyPriority = cephSnapshotStrategy.canHandle(snapshot, snapshotOps[i]);
if (snapshotOps[i] == SnapshotOperation.REVERT && isSnapshotStoredOnRbdStoragePool) {
Assert.assertEquals(StrategyPriority.HIGHEST, strategyPriority);
} else {
Assert.assertEquals(StrategyPriority.CANT_HANDLE, strategyPriority);
}
}
}
Aggregations