use of org.ovirt.engine.core.common.businessentities.gluster.Mempool in project ovirt-engine by oVirt.
the class GlusterBrickDetailMapper method map.
@Mapping(from = GlusterVolumeAdvancedDetails.class, to = GlusterBrick.class)
public static GlusterBrick map(GlusterVolumeAdvancedDetails fromEntity, GlusterBrick toModel) {
GlusterBrick model = (toModel == null) ? new GlusterBrick() : toModel;
if (fromEntity.getBrickDetails() == null) {
return model;
}
// Since the getDetails call is for a single brick the list size will always be 1 - so get the first element
BrickDetails detail = (fromEntity.getBrickDetails().size() > 0) ? fromEntity.getBrickDetails().get(0) : null;
if (detail == null) {
return model;
}
model = mapBrickProperties(detail, model);
if (detail.getClients() != null) {
model.setGlusterClients(new GlusterClients());
for (GlusterClientInfo clientEntity : detail.getClients()) {
model.getGlusterClients().getGlusterClients().add(map(clientEntity));
}
}
if (detail.getMemoryStatus() != null && detail.getMemoryStatus().getMemPools() != null) {
model.setMemoryPools(new GlusterMemoryPools());
for (Mempool pool : detail.getMemoryStatus().getMemPools()) {
model.getMemoryPools().getGlusterMemoryPools().add(map(pool));
}
}
return model;
}
use of org.ovirt.engine.core.common.businessentities.gluster.Mempool in project ovirt-engine by oVirt.
the class GlusterBrickDetailMapperTest method getMemoryStatus.
private MemoryStatus getMemoryStatus(int listSize) {
MemoryStatus memStatus = new MemoryStatus();
memStatus.setMallInfo(new MallInfo());
memStatus.getMallInfo().setArena(RandomUtils.instance().nextInt());
memStatus.getMallInfo().setUordblks(RandomUtils.instance().nextInt());
ArrayList<Mempool> memPoolsList = new ArrayList<>();
for (int i = 0; i < listSize; i++) {
Mempool pool = new Mempool();
pool.setAllocCount(RandomUtils.instance().nextInt());
pool.setHotCount(0);
pool.setName(RandomUtils.instance().nextString(5));
memPoolsList.add(pool);
}
memStatus.setMemPools(memPoolsList);
return memStatus;
}
use of org.ovirt.engine.core.common.businessentities.gluster.Mempool in project ovirt-engine by oVirt.
the class GetGlusterVolumeAdvancedDetailsQueryTest method getMemPools.
private List<Mempool> getMemPools() {
Mempool memPool = new Mempool();
memPool.setAllocCount(0);
memPool.setColdCount(1024);
memPool.setHotCount(0);
memPool.setMaxAlloc(0);
memPool.setMaxStdAlloc(0);
memPool.setName("v1-server:fd_t");
memPool.setPadddedSize(100);
memPool.setPoolMisses(0);
return Collections.singletonList(memPool);
}
use of org.ovirt.engine.core.common.businessentities.gluster.Mempool in project ovirt-engine by oVirt.
the class GlusterVolumeStatusReturn method prepareMemPool.
private List<Mempool> prepareMemPool(Object[] memoryPool) {
List<Mempool> memPoolList = new ArrayList<>();
for (Object memPoolObj : memoryPool) {
Mempool glusterMemoryPool = new Mempool();
Map<String, Object> memPool = (Map<String, Object>) memPoolObj;
glusterMemoryPool.setName((String) memPool.get(MEMORY_NAME));
glusterMemoryPool.setHotCount(Integer.parseInt((String) memPool.get(MEMORY_HOTCOUNT)));
glusterMemoryPool.setColdCount(Integer.parseInt((String) memPool.get(MEMORY_COLDCOUNT)));
glusterMemoryPool.setPadddedSize(Integer.parseInt((String) memPool.get(MEMORY_PADDDEDSIZEOF)));
glusterMemoryPool.setAllocCount(Integer.parseInt((String) memPool.get(MEMORY_ALLOCCOUNT)));
glusterMemoryPool.setMaxAlloc(Integer.parseInt((String) memPool.get(MEMORY_MAXALLOC)));
glusterMemoryPool.setPoolMisses(Integer.parseInt((String) memPool.get(MEMORY_POOLMISSES)));
glusterMemoryPool.setMaxStdAlloc(Integer.parseInt((String) memPool.get(MEMORY_MAXSTDALLOC)));
memPoolList.add(glusterMemoryPool);
}
return memPoolList;
}
use of org.ovirt.engine.core.common.businessentities.gluster.Mempool in project ovirt-engine by oVirt.
the class GlusterBrickDetailMapper method map.
@Mapping(from = MemoryStatus.class, to = GlusterBrickMemoryInfo.class)
public static GlusterBrickMemoryInfo map(MemoryStatus memoryStatusEntity) {
GlusterBrickMemoryInfo memInfo = new GlusterBrickMemoryInfo();
if (memoryStatusEntity == null) {
return null;
}
memInfo.setMemoryPools(new GlusterMemoryPools());
for (Mempool pool : memoryStatusEntity.getMemPools()) {
memInfo.getMemoryPools().getGlusterMemoryPools().add(map(pool));
}
return memInfo;
}
Aggregations