Search in sources :

Example 56 with StorageServerConnections

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

the class UpdateStorageServerConnectionCommandTest method checkNoHost.

@Test
public void checkNoHost() {
    StorageServerConnections newNFSConnection = createNFSConnection("multipass.my.domain.tlv.company.com:/export/allstorage/data2", StorageType.NFS, NfsVersion.V4, 300, 0);
    parameters.setStorageServerConnection(newNFSConnection);
    parameters.setVdsId(null);
    parameters.setStorageServerConnection(newNFSConnection);
    when(storageConnDao.get(newNFSConnection.getId())).thenReturn(oldNFSConnection);
    ValidateTestUtils.runAndAssertValidateSuccess(command);
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Test(org.junit.Test)

Example 57 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections 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 58 with StorageServerConnections

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

the class UpdateStorageServerConnectionCommandTest method isConnWithSameDetailsExistBlockDomains.

@Test
public void isConnWithSameDetailsExistBlockDomains() {
    StorageServerConnections newISCSIConnection = createISCSIConnection("1.2.3.4", StorageType.ISCSI, "iqn.2013-04.myhat.com:aaa-target1", "3260", "user1", "mypassword123");
    StorageServerConnections connection1 = createISCSIConnection("1.2.3.4", StorageType.ISCSI, "iqn.2013-04.myhat.com:aaa-target1", "3260", "user1", "mypassword123");
    when(iscsiStorageHelper.findConnectionWithSameDetails(newISCSIConnection)).thenReturn(connection1);
    boolean isExists = command.isConnWithSameDetailsExists(newISCSIConnection, null);
    assertTrue(isExists);
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Test(org.junit.Test)

Example 59 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections 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 60 with StorageServerConnections

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

the class UpdateStorageServerConnectionCommandTest method failDomainIsActive.

@Test
public void failDomainIsActive() {
    StorageServerConnections NFSConnection = createNFSConnection("multipass.my.domain.tlv.company.com:/export/allstorage/data2", StorageType.NFS, NfsVersion.V4, 300, 0);
    when(command.getConnection()).thenReturn(NFSConnection);
    doReturn(oldNFSConnection).when(storageConnDao).get(any());
    // Create an active domain.
    StorageDomain domain = new StorageDomain();
    domain.setStatus(StorageDomainStatus.Active);
    domain.setStorageDomainSharedStatus(StorageDomainSharedStatus.Active);
    initDomainListForConnection(NFSConnection.getId(), domain);
    ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_UNSUPPORTED_ACTION_DOMAIN_MUST_BE_IN_MAINTENANCE_OR_UNATTACHED);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Test(org.junit.Test)

Aggregations

StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)181 Test (org.junit.Test)83 ArrayList (java.util.ArrayList)43 Guid (org.ovirt.engine.core.compat.Guid)39 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)33 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)32 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)19 List (java.util.List)18 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)17 VDS (org.ovirt.engine.core.common.businessentities.VDS)16 StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)15 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)15 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)14 HashSet (java.util.HashSet)13 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)11 ActionType (org.ovirt.engine.core.common.action.ActionType)11 Set (java.util.Set)10 StorageConnection (org.ovirt.engine.api.model.StorageConnection)10 StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)10 QueryType (org.ovirt.engine.core.common.queries.QueryType)10