Search in sources :

Example 36 with StorageDomainStatic

use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.

the class AddExistingBlockStorageDomainCommandTest method getStorageDomain.

private static StorageDomainStatic getStorageDomain() {
    StorageDomainStatic storageDomain = new StorageDomainStatic();
    storageDomain.setStorage(Guid.newGuid().toString());
    return storageDomain;
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic)

Example 37 with StorageDomainStatic

use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.

the class AddExistingFileStorageDomainCommandTest method getStorageDomain.

private static StorageDomainStatic getStorageDomain() {
    StorageDomainStatic storageDomain = new StorageDomainStatic();
    storageDomain.setStorage(Guid.newGuid().toString());
    storageDomain.setStorageDomainType(StorageDomainType.Data);
    storageDomain.setStorageFormat(StorageFormatType.V3);
    return storageDomain;
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic)

Example 38 with StorageDomainStatic

use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.

the class AddExistingFileStorageDomainCommandTest method testAddExistingSuccessfully.

@Test
public void testAddExistingSuccessfully() {
    StorageDomainStatic sdStatic = command.getStorageDomain().getStorageStaticData();
    doReturn(new Pair<>(sdStatic, sdStatic.getId())).when(command).executeHSMGetStorageDomainInfo(any());
    ValidateTestUtils.runAndAssertValidateSuccess(command);
    command.executeCommand();
    assertTrue(command.getReturnValue().getSucceeded());
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 39 with StorageDomainStatic

use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.

the class AddStorageDomainCommonTest method setUp.

@Before
public void setUp() {
    Guid vdsId = Guid.newGuid();
    spId = Guid.newGuid();
    connId = Guid.newGuid();
    sd = new StorageDomainStatic();
    sd.setId(Guid.newGuid());
    sd.setStorageType(StorageType.NFS);
    sd.setStorageDomainType(StorageDomainType.Data);
    sd.setStorageName("newStorage");
    sd.setStorageFormat(StorageFormatType.V3);
    sd.setStorage(connId.toString());
    VDS vds = new VDS();
    vds.setId(vdsId);
    vds.setStatus(VDSStatus.Up);
    vds.setStoragePoolId(spId);
    when(vdsDao.get(vdsId)).thenReturn(vds);
    sp = new StoragePool();
    sp.setId(spId);
    sp.setCompatibilityVersion(Version.getLast());
    when(spDao.get(spId)).thenReturn(sp);
    StorageServerConnections conn = new StorageServerConnections();
    conn.setId(connId.toString());
    conn.setStorageType(StorageType.NFS);
    when(sscDao.get(connId.toString())).thenReturn(conn);
    cmd.getParameters().setStorageDomainId(sd.getId());
    cmd.getParameters().setStorageDomain(sd);
    cmd.getParameters().setVdsId(vdsId);
    cmd.setVdsId(vdsId);
    cmd.init();
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) VDS(org.ovirt.engine.core.common.businessentities.VDS) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Guid(org.ovirt.engine.core.compat.Guid) Before(org.junit.Before)

Example 40 with StorageDomainStatic

use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.

the class AttachStorageDomainToPoolCommandTest method statusSetInMap.

@Test
public void statusSetInMap() {
    cmd.init();
    Guid storageDomainId = cmd.getStorageDomainId();
    Guid poolId = cmd.getStoragePoolId();
    doNothing().when(cmd).attemptToActivateDomain();
    doReturn(Collections.singletonList(new Pair<>(Guid.newGuid(), true))).when(cmd).connectHostsInUpToDomainStorageServer();
    StoragePool pool = new StoragePool();
    pool.setId(poolId);
    pool.setStatus(StoragePoolStatus.Up);
    when(storagePoolDao.get(any())).thenReturn(pool);
    when(isoMapDao.get(any())).thenReturn(map);
    when(storageDomainDao.getForStoragePool(any(), any())).thenReturn(new StorageDomain());
    when(storageDomainStaticDao.get(any())).thenReturn(new StorageDomainStatic());
    doReturn(pool.getId()).when(cmd).getStoragePoolIdFromVds();
    ActionReturnValue actionReturnValue = new ActionReturnValue();
    actionReturnValue.setSucceeded(true);
    when(backendInternal.runInternalAction(any(), any(), any())).thenReturn(actionReturnValue);
    StorageDomainStatic storageDomain = new StorageDomainStatic();
    storageDomain.setId(Guid.newGuid());
    storageDomain.setStorageDomainType(StorageDomainType.ImportExport);
    mockGetStorageDomainInfoVdsCommand(storageDomain);
    mockAttachStorageDomainVdsCommand();
    when(vdsDao.get(any())).thenReturn(vds);
    doReturn(Collections.emptyList()).when(cmd).getEntitiesFromStorageOvfDisk(storageDomainId, pool.getId());
    doReturn(Collections.emptyList()).when(cmd).getAllOVFDisks(storageDomainId, pool.getId());
    doAnswer(invocation -> {
        map = (StoragePoolIsoMap) invocation.getArguments()[0];
        return null;
    }).when(isoMapDao).save(any());
    cmd.setCompensationContext(mock(CompensationContext.class));
    cmd.executeCommand();
    assertNotNull(map);
    assertEquals(StorageDomainStatus.Maintenance, map.getStatus());
}
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) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) CompensationContext(org.ovirt.engine.core.bll.context.CompensationContext) Guid(org.ovirt.engine.core.compat.Guid) Pair(org.ovirt.engine.core.common.utils.Pair) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Aggregations

StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)92 Guid (org.ovirt.engine.core.compat.Guid)39 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)35 ArrayList (java.util.ArrayList)33 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)31 Test (org.junit.Test)23 Pair (org.ovirt.engine.core.common.utils.Pair)19 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)18 StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)15 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)15 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)14 List (java.util.List)13 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)13 StorageDomainManagementParameter (org.ovirt.engine.core.common.action.StorageDomainManagementParameter)13 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)13 VDS (org.ovirt.engine.core.common.businessentities.VDS)12 HashSet (java.util.HashSet)11 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)11 ActionType (org.ovirt.engine.core.common.action.ActionType)11 AttachStorageDomainToPoolParameters (org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters)10