Search in sources :

Example 11 with LUNs

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

the class AbstractSyncStorageDomainsLunsCommandTest method setUp.

@Before
public void setUp() {
    blockSd1Id = Guid.newGuid();
    String sd1Name = "vg1";
    blockSd1 = new StorageDomain();
    blockSd1.setId(blockSd1Id);
    blockSd1.setStorageType(StorageType.ISCSI);
    blockSd1.setStatus(StorageDomainStatus.Active);
    blockSd1.setStorage(sd1Name);
    blockSd1Lun1 = new LUNs();
    blockSd1Lun1.setId("blockSd1Lun1");
    blockSd1Lun1.setVolumeGroupId(sd1Name);
    blockSd1Lun1.setStorageDomainId(blockSd1Id);
    blockSd2Id = Guid.newGuid();
    String sd2Name = "vg2";
    blockSd2 = new StorageDomain();
    blockSd2.setId(blockSd2Id);
    blockSd2.setStorageType(StorageType.FCP);
    blockSd2.setStatus(StorageDomainStatus.Active);
    blockSd2.setStorage(sd2Name);
    blockSd2Lun1 = new LUNs();
    blockSd2Lun1.setId("blockSd2Lun1");
    blockSd2Lun2 = new LUNs();
    blockSd2Lun2.setId("blockSd2Lun2");
    blockSd2Lun1.setVolumeGroupId(sd2Name);
    blockSd2Lun1.setStorageDomainId(blockSd2Id);
    blockSd2Lun2.setVolumeGroupId(sd2Name);
    blockSd2Lun2.setStorageDomainId(blockSd2Id);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Before(org.junit.Before)

Example 12 with LUNs

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

the class SyncDirectLunsCommandTest method setUp.

@Before
public void setUp() {
    lun1 = new LUNs();
    lun1.setLUNId("lun1");
    lun1.setDiskId(Guid.newGuid());
    lun1.setVolumeGroupId("");
    disk1Lun1Map = new DiskLunMap(lun1.getDiskId(), lun1.getLUNId());
    lun2 = new LUNs();
    lun2.setLUNId("lun2");
    lun2.setDiskId(Guid.newGuid());
    lun2.setVolumeGroupId("");
    lun3 = new LUNs();
    lun3.setLUNId("lun3");
    lun3.setDiskId(Guid.newGuid());
    lun3.setVolumeGroupId("");
    mockLunDao();
}
Also used : LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) DiskLunMap(org.ovirt.engine.core.common.businessentities.storage.DiskLunMap) Before(org.junit.Before)

Example 13 with LUNs

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

the class BackendStorageDomainsResourceTest method setUpLuns.

protected List<LUNs> setUpLuns() {
    StorageServerConnections cnx = new StorageServerConnections();
    cnx.setConnection(ADDRESSES[0]);
    cnx.setIqn(TARGET);
    cnx.setPort(Integer.toString(PORT));
    LUNs lun = new LUNs();
    lun.setLUNId(LUN);
    lun.setLunConnections(new ArrayList<>());
    lun.getLunConnections().add(cnx);
    List<LUNs> luns = new ArrayList<>();
    luns.add(lun);
    return luns;
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ArrayList(java.util.ArrayList) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 14 with LUNs

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

the class BackendStorageDomainsResourceTest method testAddIscsiStorageDomainAssumingConnection.

@Test
public void testAddIscsiStorageDomainAssumingConnection() throws Exception {
    StorageDomain model = getIscsi();
    Host host = new Host();
    host.setId(GUIDS[0].toString());
    model.setHost(host);
    for (LogicalUnit lun : model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits()) {
        lun.setAddress(null);
        lun.setTarget(null);
    }
    setUriInfo(setUpBasicUriExpectations());
    setUpGetEntityExpectations(QueryType.GetDeviceList, GetDeviceListQueryParameters.class, new String[] { "Id", "StorageType" }, new Object[] { GUIDS[0], org.ovirt.engine.core.common.businessentities.storage.StorageType.ISCSI }, "this return value isn't used");
    List<LUNs> luns = setUpLuns();
    setUpGetEntityExpectations(QueryType.GetLunsByVgId, GetLunsByVgIdParameters.class, new String[] { "VgId" }, new Object[] { GUIDS[GUIDS.length - 1].toString() }, luns);
    setUpCreationExpectations(ActionType.AddSANStorageDomain, AddSANStorageDomainParameters.class, new String[] { "VdsId" }, new Object[] { GUIDS[0] }, true, true, GUIDS[0], QueryType.GetStorageDomainById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getIscsiEntity());
    Response response = collection.add(model);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof StorageDomain);
    verifyIscsi((StorageDomain) response.getEntity());
}
Also used : Response(javax.ws.rs.core.Response) StorageDomain(org.ovirt.engine.api.model.StorageDomain) LogicalUnit(org.ovirt.engine.api.model.LogicalUnit) Host(org.ovirt.engine.api.model.Host) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Test(org.junit.Test)

Example 15 with LUNs

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

the class SanStorageModelBase method updateInternal.

protected void updateInternal() {
    if (!(getContainer().isNewStorage() || getContainer().isStorageActive())) {
        return;
    }
    VDS host = getContainer().getHost().getSelectedItem();
    if (host == null) {
        proposeDiscover();
        return;
    }
    final Collection<EntityModel<?>> prevSelected = Linq.findSelectedItems((Collection<EntityModel<?>>) getSelectedItem());
    clearItems();
    initializeItems(null, null);
    final SanStorageModelBase model = this;
    AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(response -> {
        if (response.getSucceeded()) {
            setValuesForMaintenance(model);
            model.applyData((ArrayList<LUNs>) response.getReturnValue(), false, prevSelected, isInMaintenance, metadata);
            model.initLunSelection();
            // $NON-NLS-1$
            model.setGetLUNsFailure("");
            model.stopProgress();
        } else {
            model.setGetLUNsFailure(ConstantsManager.getInstance().getConstants().couldNotRetrieveLUNsLunsFailure());
        }
    }, true);
    Frontend.getInstance().runQuery(QueryType.GetDeviceList, new GetDeviceListQueryParameters(host.getId(), getType(), false, null, false), asyncQuery);
    getContainer().startProgress();
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VDS(org.ovirt.engine.core.common.businessentities.VDS) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) GetDeviceListQueryParameters(org.ovirt.engine.core.common.queries.GetDeviceListQueryParameters) 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