Search in sources :

Example 86 with StoragePool

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);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 87 with StoragePool

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());
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) StorageDomainsAndStoragePoolIdQueryParameters(org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) Pair(org.ovirt.engine.core.common.utils.Pair) Test(org.junit.Test)

Example 88 with StoragePool

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);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 89 with StoragePool

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());
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 90 with StoragePool

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());
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Aggregations

StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)239 Guid (org.ovirt.engine.core.compat.Guid)83 ArrayList (java.util.ArrayList)78 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)60 Test (org.junit.Test)59 List (java.util.List)46 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)39 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)35 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)34 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)33 VDS (org.ovirt.engine.core.common.businessentities.VDS)31 QueryType (org.ovirt.engine.core.common.queries.QueryType)31 Frontend (org.ovirt.engine.ui.frontend.Frontend)31 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)28 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)28 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)27 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)27 Linq (org.ovirt.engine.ui.uicommonweb.Linq)26 Arrays (java.util.Arrays)25 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)25