Search in sources :

Example 1 with LogicalUnits

use of org.ovirt.engine.api.model.LogicalUnits in project ovirt-engine by oVirt.

the class BackendStorageDomainResourceTest method testRefreshLunsSize.

@Test
public void testRefreshLunsSize() throws Exception {
    List<String> lunsArray = new ArrayList();
    lunsArray.add(GUIDS[2].toString());
    setUriInfo(setUpActionExpectations(ActionType.RefreshLunsSize, ExtendSANStorageDomainParameters.class, new String[] { "LunIds" }, new Object[] { lunsArray }, true, true));
    Action action = new Action();
    LogicalUnits luns = new LogicalUnits();
    LogicalUnit lun = new LogicalUnit();
    lun.setId(GUIDS[2].toString());
    luns.getLogicalUnits().add(lun);
    action.setLogicalUnits(luns);
    verifyActionResponse(resource.refreshLuns(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) LogicalUnit(org.ovirt.engine.api.model.LogicalUnit) ArrayList(java.util.ArrayList) ExtendSANStorageDomainParameters(org.ovirt.engine.core.common.action.ExtendSANStorageDomainParameters) Test(org.junit.Test)

Example 2 with LogicalUnits

use of org.ovirt.engine.api.model.LogicalUnits in project ovirt-engine by oVirt.

the class BackendStorageDomainsResourceTest method getIscsi.

protected StorageDomain getIscsi() {
    StorageDomain model = getModel(0);
    model.getStorage().setType(StorageType.ISCSI);
    model.getStorage().setAddress(null);
    model.getStorage().setPath(null);
    model.getStorage().setVolumeGroup(new VolumeGroup());
    model.getStorage().getVolumeGroup().setLogicalUnits(new LogicalUnits());
    model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().add(new LogicalUnit());
    model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setId(LUN);
    model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setTarget(TARGET);
    model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setAddress(ADDRESSES[0]);
    model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setPort(PORT);
    model.getStorage().setOverrideLuns(false);
    return model;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) VolumeGroup(org.ovirt.engine.api.model.VolumeGroup) LogicalUnit(org.ovirt.engine.api.model.LogicalUnit)

Example 3 with LogicalUnits

use of org.ovirt.engine.api.model.LogicalUnits in project ovirt-engine by oVirt.

the class BackendStorageDomainResourceTest method reduceLuns.

@Test
public void reduceLuns() throws Exception {
    List<String> paramsLuns = new LinkedList<>();
    paramsLuns.add(GUIDS[2].toString());
    paramsLuns.add(GUIDS[3].toString());
    setUriInfo(setUpActionExpectations(ActionType.ReduceSANStorageDomainDevices, ReduceSANStorageDomainDevicesCommandParameters.class, new String[] { "DevicesToReduce", "StorageDomainId" }, new Object[] { paramsLuns, GUIDS[0] }, true, true));
    Action action = new Action();
    LogicalUnits luns = new LogicalUnits();
    paramsLuns.forEach(s -> {
        LogicalUnit lun = new LogicalUnit();
        lun.setId(s);
        luns.getLogicalUnits().add(lun);
    });
    action.setLogicalUnits(luns);
    verifyActionResponse(resource.reduceLuns(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) LogicalUnit(org.ovirt.engine.api.model.LogicalUnit) ReduceSANStorageDomainDevicesCommandParameters(org.ovirt.engine.core.common.action.ReduceSANStorageDomainDevicesCommandParameters) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Example 4 with LogicalUnits

use of org.ovirt.engine.api.model.LogicalUnits in project ovirt-engine by oVirt.

the class V3StorageInAdapter method adapt.

@Override
public HostStorage adapt(V3Storage from) {
    HostStorage to = new HostStorage();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetAddress()) {
        to.setAddress(from.getAddress());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetHost()) {
        to.setHost(adaptIn(from.getHost()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetLogicalUnits()) {
        to.setLogicalUnits(new LogicalUnits());
        to.getLogicalUnits().getLogicalUnits().addAll(adaptIn(from.getLogicalUnits()));
    }
    if (from.isSetMountOptions()) {
        to.setMountOptions(from.getMountOptions());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetNfsRetrans()) {
        to.setNfsRetrans(from.getNfsRetrans());
    }
    if (from.isSetNfsTimeo()) {
        to.setNfsTimeo(from.getNfsTimeo());
    }
    if (from.isSetNfsVersion()) {
        to.setNfsVersion(NfsVersion.fromValue(from.getNfsVersion()));
    }
    if (from.isSetOverrideLuns()) {
        to.setOverrideLuns(from.isOverrideLuns());
    }
    if (from.isSetPassword()) {
        to.setPassword(from.getPassword());
    }
    if (from.isSetPath()) {
        to.setPath(from.getPath());
    }
    if (from.isSetPort()) {
        to.setPort(from.getPort());
    }
    if (from.isSetPortal()) {
        to.setPortal(from.getPortal());
    }
    if (from.isSetTarget()) {
        to.setTarget(from.getTarget());
    }
    if (from.isSetType()) {
        to.setType(StorageType.fromValue(from.getType()));
    }
    if (from.isSetUsername()) {
        to.setUsername(from.getUsername());
    }
    if (from.isSetVfsType()) {
        to.setVfsType(from.getVfsType());
    }
    if (from.isSetVolumeGroup()) {
        to.setVolumeGroup(adaptIn(from.getVolumeGroup()));
    }
    return to;
}
Also used : LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) HostStorage(org.ovirt.engine.api.model.HostStorage)

Example 5 with LogicalUnits

use of org.ovirt.engine.api.model.LogicalUnits in project ovirt-engine by oVirt.

the class V3VolumeGroupInAdapter method adapt.

@Override
public VolumeGroup adapt(V3VolumeGroup from) {
    VolumeGroup to = new VolumeGroup();
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetLogicalUnits()) {
        to.setLogicalUnits(new LogicalUnits());
        to.getLogicalUnits().getLogicalUnits().addAll(adaptIn(from.getLogicalUnits()));
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    return to;
}
Also used : LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) VolumeGroup(org.ovirt.engine.api.model.VolumeGroup) V3VolumeGroup(org.ovirt.engine.api.v3.types.V3VolumeGroup)

Aggregations

LogicalUnits (org.ovirt.engine.api.model.LogicalUnits)9 LogicalUnit (org.ovirt.engine.api.model.LogicalUnit)7 VolumeGroup (org.ovirt.engine.api.model.VolumeGroup)4 HostStorage (org.ovirt.engine.api.model.HostStorage)3 Test (org.junit.Test)2 Action (org.ovirt.engine.api.model.Action)2 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)2 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 Disk (org.ovirt.engine.api.model.Disk)1 StorageDomain (org.ovirt.engine.api.model.StorageDomain)1 V3VolumeGroup (org.ovirt.engine.api.v3.types.V3VolumeGroup)1 ExtendSANStorageDomainParameters (org.ovirt.engine.core.common.action.ExtendSANStorageDomainParameters)1 ReduceSANStorageDomainDevicesCommandParameters (org.ovirt.engine.core.common.action.ReduceSANStorageDomainDevicesCommandParameters)1 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)1