use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class MoveOrCopyDiskCommandTest method testMoveMemoryVolumesFailsOnUnsupportedVersion.
@Test
public void testMoveMemoryVolumesFailsOnUnsupportedVersion() {
initializeCommand(new DiskImage(), VmEntityType.VM);
command.getImage().setContentType(DiskContentType.MEMORY_DUMP_VOLUME);
StoragePool storagePool = new StoragePool();
storagePool.setCompatibilityVersion(Version.v4_1);
doReturn(storagePool).when(command).getStoragePool();
ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_DISK_CONTENT_TYPE_NOT_SUPPORTED_FOR_OPERATION);
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class GetStorageDomainsWithAttachedStoragePoolGuidQueryTest method testStoragePoolIsUninitializedButCheckBooleanIsFalse.
@Test
public void testStoragePoolIsUninitializedButCheckBooleanIsFalse() {
StoragePool storagePool = new StoragePool();
storagePool.setStatus(StoragePoolStatus.Uninitialized);
mockStoragePoolDao(storagePool);
// Create parameters
List<StorageDomain> storageDomainList = new ArrayList<>();
storageDomainList.add(storageDomain);
StorageDomainsAndStoragePoolIdQueryParameters paramsMock = getQueryParameters();
when(paramsMock.getStorageDomainList()).thenReturn(storageDomainList);
when(paramsMock.isCheckStoragePoolStatus()).thenReturn(Boolean.FALSE);
// Run 'HSMGetStorageDomainInfo' command
VDSReturnValue returnValue = new VDSReturnValue();
returnValue.setSucceeded(true);
Pair<StorageDomainStatic, Guid> storageDomainToPoolId = new Pair<>(storageDomain.getStorageStaticData(), Guid.newGuid());
returnValue.setReturnValue(storageDomainToPoolId);
when(vdsBrokerFrontendMock.runVdsCommand(eq(VDSCommandType.HSMGetStorageDomainInfo), any())).thenReturn(returnValue);
// Execute command
getQuery().executeQueryCommand();
// Assert the query's results
List<StorageDomainStatic> returnedStorageDomainList = new ArrayList<>();
returnedStorageDomainList.add(storageDomain.getStorageStaticData());
assertEquals(returnedStorageDomainList, getQuery().getQueryReturnValue().getReturnValue());
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class ImportHostedEngineStorageDomainCommandTest method failIfDcNotActive.
@Test
public void failIfDcNotActive() throws Exception {
mockGetExistingDomain(true);
StoragePool pool = new StoragePool();
pool.setStatus(StoragePoolStatus.Uninitialized);
when(storagePoolDao.get(HE_SP_ID)).thenReturn(pool);
cmd.init();
cmd.validate();
ValidateTestUtils.assertValidationMessages("", cmd, EngineMessage.ACTION_TYPE_FAILED_MASTER_STORAGE_DOMAIN_NOT_ACTIVE);
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class StorageDomainCommandBaseTest method shouldElectStorageTypeAfterLastUsedAsMasterDataDomain2.
@Test
public void shouldElectStorageTypeAfterLastUsedAsMasterDataDomain2() {
StorageDomain localDomain = createDataStorageDomain(StorageDomainStatus.Active, "local domain name", LOCAL_SD_ID);
localDomain.setLastTimeUsedAsMaster(System.currentTimeMillis());
localDomain.setStorageType(StorageType.LOCALFS);
StorageDomain sharedDomain = createDataStorageDomain(StorageDomainStatus.Active, "shared domain name", SHARED_SD_ID);
sharedDomain.setLastTimeUsedAsMaster(System.currentTimeMillis() - 1000);
when(storageDomainDao.getAllForStoragePool(any())).thenReturn(Arrays.asList(sharedDomain, localDomain));
cmd.setStoragePool(new StoragePool());
assertEquals(sharedDomain, cmd.electNewMaster());
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class StorageDomainCommandBaseTest method shouldElectActiveSharedBeforeLocalDataDomain2.
@Test
public void shouldElectActiveSharedBeforeLocalDataDomain2() {
StorageDomain localDomain = createDataStorageDomain(StorageDomainStatus.Active, "local domain name", LOCAL_SD_ID);
localDomain.setStorageType(StorageType.LOCALFS);
StorageDomain sharedDomain = createDataStorageDomain(StorageDomainStatus.Active, "shared domain name", SHARED_SD_ID);
when(storageDomainDao.getAllForStoragePool(any())).thenReturn(Arrays.asList(sharedDomain, localDomain));
cmd.setStoragePool(new StoragePool());
assertEquals(sharedDomain, cmd.electNewMaster());
}
Aggregations