Search in sources :

Example 1 with Mempool

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;
}
Also used : GlusterMemoryPools(org.ovirt.engine.api.model.GlusterMemoryPools) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) GlusterClientInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo) Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool) GlusterClients(org.ovirt.engine.api.model.GlusterClients) GlusterBrick(org.ovirt.engine.api.model.GlusterBrick)

Example 2 with Mempool

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;
}
Also used : MallInfo(org.ovirt.engine.core.common.businessentities.gluster.MallInfo) MemoryStatus(org.ovirt.engine.core.common.businessentities.gluster.MemoryStatus) ArrayList(java.util.ArrayList) Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool)

Example 3 with Mempool

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);
}
Also used : Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool)

Example 4 with 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;
}
Also used : ArrayList(java.util.ArrayList) Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool) Map(java.util.Map)

Example 5 with Mempool

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;
}
Also used : GlusterMemoryPools(org.ovirt.engine.api.model.GlusterMemoryPools) GlusterBrickMemoryInfo(org.ovirt.engine.api.model.GlusterBrickMemoryInfo) Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool)

Aggregations

Mempool (org.ovirt.engine.core.common.businessentities.gluster.Mempool)6 ArrayList (java.util.ArrayList)3 Map (java.util.Map)2 GlusterMemoryPools (org.ovirt.engine.api.model.GlusterMemoryPools)2 BrickDetails (org.ovirt.engine.core.common.businessentities.gluster.BrickDetails)2 GlusterClientInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo)2 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 GlusterBrick (org.ovirt.engine.api.model.GlusterBrick)1 GlusterBrickMemoryInfo (org.ovirt.engine.api.model.GlusterBrickMemoryInfo)1 GlusterClients (org.ovirt.engine.api.model.GlusterClients)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 GlusterVolumeBricksActionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeBricksActionParameters)1 GlusterVolumeRemoveBricksParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters)1 GlusterVolumeReplaceBrickActionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeReplaceBrickActionParameters)1 GlusterVolumeResetBrickActionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeResetBrickActionParameters)1 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)1 GlusterTaskType (org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType)1