/** * Create an instance of {@link LogicalUnits } * */ public LogicalUnits createLogicalUnits() { return new LogicalUnits(); }
protected void mapVolumeGroupFcp(StorageDomain model, org.ovirt.engine.core.common.businessentities.StorageDomain entity) { VolumeGroup vg = model.getStorage().getVolumeGroup(); List<LUNs> luns = getLunsByVgId(vg.getId()); if (luns != null && !luns.isEmpty()) { vg.setLogicalUnits(new LogicalUnits()); for (LUNs lun : luns) { LogicalUnit unit = map(lun); vg.getLogicalUnits().getLogicalUnits().add(unit); } } }
protected void mapVolumeGroupIscsi(StorageDomain model, org.ovirt.engine.core.common.businessentities.StorageDomain entity) { VolumeGroup vg = model.getStorage().getVolumeGroup(); List<LUNs> luns = getLunsByVgId(vg.getId()); if (luns != null && !luns.isEmpty()) { vg.setLogicalUnits(new LogicalUnits()); for (LUNs lun : luns) { List<StorageServerConnections> lunConnections = lun.getLunConnections(); if (lunConnections != null) { for (StorageServerConnections cnx : lunConnections) { LogicalUnit unit = map(lun); unit = map(cnx, unit); vg.getLogicalUnits().getLogicalUnits().add(unit); } } } } }
@Mapping(from = LUNs.class, to = HostStorage.class) public static HostStorage map(LUNs entity, HostStorage template) { HostStorage model = template != null ? template : new HostStorage(); model.setId(entity.getLUNId()); model.setType(StorageDomainMapper.map(entity.getLunType(), null)); model.setLogicalUnits(new LogicalUnits()); model.getLogicalUnits().getLogicalUnits().add(map(entity, (LogicalUnit) null)); return model; }
@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; } }
@Test public void reduceLuns() { 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)); }
@Test public void testRefreshLunsSize() { 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)); }
private Disk createIscsiLunDisk() { Disk model = getModel(); model.setLunStorage(new HostStorage()); model.getLunStorage().setType(StorageType.ISCSI); model.getLunStorage().setLogicalUnits(new LogicalUnits()); model.getLunStorage().getLogicalUnits().getLogicalUnits().add(new LogicalUnit()); model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setId(GUIDS[0].toString()); model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setAddress(ISCSI_SERVER_ADDRESS); model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setTarget(ISCSI_SERVER_TARGET); model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setPort(ISCSI_SERVER_CONNECTION_PORT); model.setProvisionedSize(null); return model; }
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; }
to.setLogicalUnits(new LogicalUnits()); to.getLogicalUnits().getLogicalUnits().addAll(adaptIn(from.getLogicalUnits()));