Search in sources :

Example 21 with LUNs

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

the class AbstractSanStorageList method updateSelectedLunWarning.

protected void updateSelectedLunWarning(LunModel lunModel) {
    LUNs lun = lunModel.getEntity();
    String warning = constants.empty();
    // Adding 'GrayedOutReasons'
    if (lun.getStorageDomainId() != null) {
        warning = messages.lunAlreadyPartOfStorageDomainWarning(lun.getStorageDomainName());
    } else if (lun.getDiskId() != null) {
        warning = messages.lunUsedByDiskWarning(lun.getDiskAlias());
    }
    model.setSelectedLunWarning(warning);
}
Also used : LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 22 with LUNs

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

the class GetDeviceListQueryTest method internalExecuteQuery.

/**
 * Test query execution
 */
private void internalExecuteQuery() {
    // Run 'GetDeviceList' command
    VDSReturnValue returnValue = new VDSReturnValue();
    returnValue.setSucceeded(true);
    returnValue.setReturnValue(lunsInput);
    when(vdsBrokerFrontendMock.runVdsCommand(eq(VDSCommandType.GetDeviceList), any())).thenReturn(returnValue);
    // Return 'lunsFromDb'
    when(lunDaoMock.getAll()).thenReturn(lunsFromDb);
    // Execute command
    getQuery().executeQueryCommand();
    // Assert the query's results
    List<LUNs> lunsActual = getQuery().getQueryReturnValue().getReturnValue();
    assertEquals(lunsExpected, lunsActual);
}
Also used : LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 23 with LUNs

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

the class GetDeviceListQueryTest method createInputLUNs.

/**
 * Create the input list of LUNs
 */
private void createInputLUNs() {
    LUNs lunWithVG = new LUNs();
    lunWithVG.setLUNId(Guid.newGuid().toString());
    lunWithVG.setVolumeGroupId(Guid.newGuid().toString());
    LUNs lunExistsInDB = new LUNs();
    lunExistsInDB.setLUNId(Guid.newGuid().toString());
    lunsInput = new ArrayList<>();
    lunsInput.add(lunWithVG);
    lunsInput.add(lunExistsInDB);
    lunsFromDb = new ArrayList<>();
    lunsFromDb.add(lunExistsInDB);
}
Also used : LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 24 with LUNs

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

the class GetLunsByVgIdQueryTest method checkReturnValue.

@SuppressWarnings("unchecked")
private void checkReturnValue() {
    assertNotNull(getQuery().getQueryReturnValue().getReturnValue());
    List<LUNs> luns = getQuery().getQueryReturnValue().getReturnValue();
    assertEquals(GUIDS.length, luns.size());
    for (int i = 0; i < GUIDS.length; i++) {
        LUNs lun = luns.get(i);
        assertNotNull(lun);
        assertEquals(GUIDS[i], lun.getLUNId());
        assertNotNull(lun.getLunConnections());
        assertEquals(1, lun.getLunConnections().size());
        StorageServerConnections cnx = lun.getLunConnections().get(0);
        assertEquals(ADDRESS, cnx.getConnection());
        assertEquals(PORT, cnx.getPort());
        assertEquals(GUIDS[i], cnx.getId());
        assertEquals(IQNS[i], cnx.getIqn());
        assertEquals(StorageType.ISCSI, cnx.getStorageType());
        assertNotNull(lun.getPathsDictionary());
        assertEquals(1, lun.getPathsDictionary().size());
    }
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 25 with LUNs

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

the class AddDiskCommandTest method createISCSILunDisk.

private static LunDisk createISCSILunDisk() {
    LunDisk disk = new LunDisk();
    LUNs lun = new LUNs();
    lun.setLUNId("lunid");
    lun.setLunType(StorageType.ISCSI);
    StorageServerConnections connection = new StorageServerConnections();
    connection.setIqn("a");
    connection.setConnection("0.0.0.0");
    connection.setPort("1234");
    ArrayList<StorageServerConnections> connections = new ArrayList<>();
    connections.add(connection);
    lun.setLunConnections(connections);
    disk.setLun(lun);
    disk.setId(Guid.newGuid());
    return disk;
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ArrayList(java.util.ArrayList) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Aggregations

LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)105 ArrayList (java.util.ArrayList)40 Test (org.junit.Test)33 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)26 Guid (org.ovirt.engine.core.compat.Guid)18 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)17 List (java.util.List)16 HashMap (java.util.HashMap)14 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)13 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)13 VDS (org.ovirt.engine.core.common.businessentities.VDS)12 VM (org.ovirt.engine.core.common.businessentities.VM)7 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)7 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)7 Map (java.util.Map)6 LUNStorageServerConnectionMap (org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMap)6 LogicalUnit (org.ovirt.engine.api.model.LogicalUnit)5 Pair (org.ovirt.engine.core.common.utils.Pair)5 GetDeviceListVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.GetDeviceListVDSCommandParameters)5 HashSet (java.util.HashSet)4