use of org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority in project cloudstack by apache.
the class KvmNonManagedStorageSystemDataMotionTest method canHandleKVMLiveStorageMigrationMultipleSources.
@Test
public void canHandleKVMLiveStorageMigrationMultipleSources() {
lenient().when(volumeInfo1.getDataStore()).thenReturn(dataStore2);
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 KvmNonManagedStorageSystemDataMotionTest method canHandleKVMLiveStorageMigrationMultipleDestination.
@Test
public void canHandleKVMLiveStorageMigrationMultipleDestination() {
migrationMap.put(volumeInfo2, dataStore3);
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 VmwareStorageMotionStrategyTest method testStrategyDoesnotHandlesNonVmwareHosts.
@Test
public void testStrategyDoesnotHandlesNonVmwareHosts() throws Exception {
Host srcHost = mock(Host.class);
Host destHost = mock(Host.class);
when(srcHost.getHypervisorType()).thenReturn(HypervisorType.XenServer);
when(destHost.getHypervisorType()).thenReturn(HypervisorType.XenServer);
Map<VolumeInfo, DataStore> volumeMap = new HashMap<VolumeInfo, DataStore>();
StrategyPriority canHandle = strategy.canHandle(volumeMap, srcHost, destHost);
assertFalse("The strategy is only supposed to handle vmware hosts", canHandle == StrategyPriority.HYPERVISOR);
}
use of org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority in project cloudstack by apache.
the class VmwareStorageMotionStrategyTest method testStrategyHandlesVmwareHosts.
@Test
public void testStrategyHandlesVmwareHosts() throws Exception {
Host srcHost = mock(Host.class);
Host destHost = mock(Host.class);
when(srcHost.getHypervisorType()).thenReturn(HypervisorType.VMware);
when(destHost.getHypervisorType()).thenReturn(HypervisorType.VMware);
Map<VolumeInfo, DataStore> volumeMap = new HashMap<VolumeInfo, DataStore>();
StrategyPriority canHandle = strategy.canHandle(volumeMap, srcHost, destHost);
assertTrue("The strategy is only supposed to handle vmware hosts", canHandle == StrategyPriority.HYPERVISOR);
}
use of org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority in project cloudstack by apache.
the class StorageSystemDataMotionStrategyTest method configureAndTestInternalCanHandle.
private void configureAndTestInternalCanHandle(boolean sPool0IsManaged, boolean sPool1IsManaged, StrategyPriority expectedStrategyPriority) {
VolumeObject volumeInfo = Mockito.spy(new VolumeObject());
Mockito.doReturn(0l).when(volumeInfo).getPoolId();
DataStore ds = Mockito.spy(new PrimaryDataStoreImpl());
Mockito.doReturn(1l).when(ds).getId();
Map<VolumeInfo, DataStore> volumeMap = new HashMap<>();
volumeMap.put(volumeInfo, ds);
StoragePoolVO storagePool0 = Mockito.spy(new StoragePoolVO());
Mockito.doReturn(sPool0IsManaged).when(storagePool0).isManaged();
StoragePoolVO storagePool1 = Mockito.spy(new StoragePoolVO());
Mockito.doReturn(sPool1IsManaged).when(storagePool1).isManaged();
Mockito.doReturn(storagePool0).when(primaryDataStoreDao).findById(0l);
Mockito.doReturn(storagePool1).when(primaryDataStoreDao).findById(1l);
StrategyPriority strategyPriority = strategy.internalCanHandle(volumeMap, new HostVO("srcHostUuid"), new HostVO("destHostUuid"));
Assert.assertEquals(expectedStrategyPriority, strategyPriority);
}
Aggregations