Search in sources :

Example 46 with VDSReturnValue

use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.

the class GetUnregisteredBlockStorageDomainsQueryTest method createGetStorageDomainInfoReturnValue.

private VDSReturnValue createGetStorageDomainInfoReturnValue() {
    VDSReturnValue returnValue = new VDSReturnValue();
    returnValue.setSucceeded(true);
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(storageDomainId);
    Pair<StorageDomainStatic, Object> pair = new Pair<>(storageDomain.getStorageStaticData(), null);
    returnValue.setReturnValue(pair);
    return returnValue;
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 47 with VDSReturnValue

use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.

the class GetUnregisteredBlockStorageDomainsQueryTest method createGetVGInfoReturnValue.

private static VDSReturnValue createGetVGInfoReturnValue(List<LUNs> luns) {
    VDSReturnValue returnValue = new VDSReturnValue();
    returnValue.setSucceeded(true);
    returnValue.setReturnValue(luns);
    return returnValue;
}
Also used : VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 48 with VDSReturnValue

use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.

the class ImportHostedEngineStorageDomainCommandTest method createVdsReturnValue.

private VDSReturnValue createVdsReturnValue(List<LUNs> luns) {
    VDSReturnValue vdsReturnValue = new VDSReturnValue();
    vdsReturnValue.setSucceeded(true);
    vdsReturnValue.setReturnValue(luns);
    return vdsReturnValue;
}
Also used : VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 49 with VDSReturnValue

use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.

the class UpdateStorageServerConnectionCommandTest method succeedUpdateNFSCommandWithDomain.

@Test
public void succeedUpdateNFSCommandWithDomain() {
    StorageServerConnections newNFSConnection = createNFSConnection("multipass.my.domain.tlv.company.com:/export/allstorage/data2", StorageType.NFS, NfsVersion.V4, 300, 0);
    parameters.setStorageServerConnection(newNFSConnection);
    VDSReturnValue returnValueConnectSuccess = new VDSReturnValue();
    StoragePoolIsoMap map = new StoragePoolIsoMap();
    returnValueConnectSuccess.setSucceeded(true);
    StorageDomain domain = createDomain();
    doReturn(Collections.singletonList(map)).when(command).getStoragePoolIsoMap(domain);
    returnValueConnectSuccess.setReturnValue(domain);
    doReturn(returnValueConnectSuccess).when(command).getStatsForDomain(domain);
    doReturn(true).when(command).connectToStorage();
    List<StorageDomain> domains = Collections.singletonList(domain);
    doReturn(domains).when(command).getStorageDomainsByConnId(newNFSConnection.getId());
    doNothing().when(command).changeStorageDomainStatusInTransaction(StorageDomainStatus.Locked);
    doNothing().when(command).disconnectFromStorage();
    doNothing().when(command).updateStorageDomain(domains);
    command.executeCommand();
    CommandAssertUtils.checkSucceeded(command, true);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) StoragePoolIsoMap(org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) Test(org.junit.Test)

Example 50 with VDSReturnValue

use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.

the class DeactivateStorageDomainCommandTest method statusSetInMap.

@Test
public void statusSetInMap() {
    doReturn(mock(IStorageHelper.class)).when(cmd).getStorageHelper(any());
    when(storagePoolDao.get(any())).thenReturn(new StoragePool());
    when(isoMapDao.get(any())).thenReturn(map);
    when(storageDomainDao.getForStoragePool(any(), any())).thenReturn(new StorageDomain());
    doReturn(Collections.emptyList()).when(cmd).getAllRunningVdssInPool();
    VDSReturnValue returnValue = new VDSReturnValue();
    returnValue.setSucceeded(true);
    when(vdsBrokerFrontend.runVdsCommand(any(), any())).thenReturn(returnValue);
    when(vdsDao.get(any())).thenReturn(vds);
    map.setStatus(StorageDomainStatus.Active);
    cmd.setCompensationContext(mock(CompensationContext.class));
    cmd.executeCommand();
    assertEquals(StorageDomainStatus.Maintenance, map.getStatus());
}
Also used : IStorageHelper(org.ovirt.engine.core.bll.storage.connection.IStorageHelper) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) CompensationContext(org.ovirt.engine.core.bll.context.CompensationContext) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Aggregations

VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)250 Guid (org.ovirt.engine.core.compat.Guid)65 ArrayList (java.util.ArrayList)43 VDS (org.ovirt.engine.core.common.businessentities.VDS)29 EngineException (org.ovirt.engine.core.common.errors.EngineException)29 Pair (org.ovirt.engine.core.common.utils.Pair)26 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)23 List (java.util.List)16 Test (org.junit.Test)15 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)15 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)15 VdsIdVDSCommandParametersBase (org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase)15 HashMap (java.util.HashMap)13 VDSError (org.ovirt.engine.core.common.errors.VDSError)13 Map (java.util.Map)11 Callable (java.util.concurrent.Callable)11 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)11 StoragePoolIsoMap (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap)11 EngineLock (org.ovirt.engine.core.utils.lock.EngineLock)9 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)8