use of org.ovirt.engine.core.common.businessentities.gluster.MemoryStatus in project ovirt-engine by oVirt.
the class GlusterVolumeStatusReturn method prepareBrickDetails.
private List<BrickDetails> prepareBrickDetails(GlusterVolumeEntity volume, Object[] bricksList) {
List<BrickDetails> brickDetailsList = new ArrayList<>();
for (Object brickObj : bricksList) {
BrickDetails brickDetails = new BrickDetails();
Map<String, Object> brick = (Map<String, Object>) brickObj;
brickDetails.setBrickProperties(getBrickProperties(volume, brick));
// Fetch Clients Details
if (brick.containsKey(CLIENTS_STATUS)) {
brickDetails.setClients(prepareClientInfo((Object[]) brick.get(CLIENTS_STATUS)));
}
// Fetch Memory Details
if (brick.containsKey(MEMORY_MALL_INFO) || brick.containsKey(MEMORY_MEM_POOL)) {
MemoryStatus memoryStatus = new MemoryStatus();
memoryStatus.setMallInfo(prepareMallInfo((Map<String, Object>) brick.get(MEMORY_MALL_INFO)));
memoryStatus.setMemPools(prepareMemPool((Object[]) brick.get(MEMORY_MEM_POOL)));
brickDetails.setMemoryStatus(memoryStatus);
}
brickDetailsList.add(brickDetails);
}
return brickDetailsList;
}
use of org.ovirt.engine.core.common.businessentities.gluster.MemoryStatus in project ovirt-engine by oVirt.
the class GetGlusterVolumeAdvancedDetailsQueryTest method getMemoryStatus.
private MemoryStatus getMemoryStatus() {
MemoryStatus memoryStatus = new MemoryStatus();
memoryStatus.setMallInfo(getMallInfo());
memoryStatus.setMemPools(getMemPools());
return memoryStatus;
}
use of org.ovirt.engine.core.common.businessentities.gluster.MemoryStatus 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.MemoryStatus in project ovirt-engine by oVirt.
the class GlusterTestHelper method getBrickEntity.
protected GlusterBrickEntity getBrickEntity(int index, boolean hasDetails) {
GlusterBrickEntity entity = mock(GlusterBrickEntity.class);
when(entity.getId()).thenReturn(GUIDS[index]);
when(entity.getServerId()).thenReturn(serverId);
when(entity.getBrickDirectory()).thenReturn(GlusterTestHelper.brickDir);
when(entity.getQualifiedName()).thenReturn(GlusterTestHelper.brickName);
when(entity.getVolumeId()).thenReturn(volumeId);
if (hasDetails) {
BrickDetails brickDetails = mock(BrickDetails.class);
BrickProperties brickProps = mock(BrickProperties.class);
MemoryStatus memStatus = mock(MemoryStatus.class);
MallInfo mallInfo = mock(MallInfo.class);
when(mallInfo.getArena()).thenReturn(888);
when(brickProps.getMntOptions()).thenReturn(GlusterTestHelper.BRICK_MNT_OPT);
when(brickProps.getPort()).thenReturn(GlusterTestHelper.BRICK_PORT);
when(brickDetails.getMemoryStatus()).thenReturn(memStatus);
when(memStatus.getMallInfo()).thenReturn(mallInfo);
when(brickDetails.getBrickProperties()).thenReturn(brickProps);
when(entity.getBrickDetails()).thenReturn(brickDetails);
}
return entity;
}
Aggregations