Search in sources :

Example 1 with GlusterClientInfo

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo in project ovirt-engine by oVirt.

the class GlusterVolumeStatusReturn method prepareClientInfo.

private List<GlusterClientInfo> prepareClientInfo(Object[] clientsStatus) {
    List<GlusterClientInfo> clientInfoList = new ArrayList<>();
    for (Object clientStatusObj : clientsStatus) {
        GlusterClientInfo clientInfo = new GlusterClientInfo();
        Map<String, Object> client = (Map<String, Object>) clientStatusObj;
        String hostName = (String) client.get(CLIENTS_HOST_NAME);
        String[] hostNameArr = hostName.split(":", -1);
        clientInfo.setHostname(hostNameArr[0]);
        clientInfo.setClientPort(Integer.parseInt(hostNameArr[1]));
        clientInfo.setBytesRead(Long.parseLong((String) client.get(CLIENTS_BYTES_READ)));
        clientInfo.setBytesWritten(Long.parseLong((String) client.get(CLIENTS_BYTES_WRITE)));
        clientInfoList.add(clientInfo);
    }
    return clientInfoList;
}
Also used : ArrayList(java.util.ArrayList) GlusterClientInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo) Map(java.util.Map)

Example 2 with GlusterClientInfo

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo 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 3 with GlusterClientInfo

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo in project ovirt-engine by oVirt.

the class GetGlusterVolumeAdvancedDetailsQueryTest method getClientInfo.

private List<GlusterClientInfo> getClientInfo() {
    GlusterClientInfo clientInfo = new GlusterClientInfo();
    clientInfo.setBytesRead(836);
    clientInfo.setBytesWritten(468);
    clientInfo.setHostname(SERVER_NAME + ":1006");
    return Collections.singletonList(clientInfo);
}
Also used : GlusterClientInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo)

Example 4 with GlusterClientInfo

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo in project ovirt-engine by oVirt.

the class GlusterBrickDetailMapperTest method getClientList.

private List<GlusterClientInfo> getClientList(int listSize) {
    ArrayList<GlusterClientInfo> list = new ArrayList<>();
    for (int i = 0; i < listSize; i++) {
        GlusterClientInfo clientInfo = new GlusterClientInfo();
        clientInfo.setBytesRead(RandomUtils.instance().nextLong());
        clientInfo.setBytesWritten(RandomUtils.instance().nextLong());
        clientInfo.setClientPort(RandomUtils.instance().nextInt());
        clientInfo.setHostname(RandomUtils.instance().nextString(7));
        list.add(clientInfo);
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) GlusterClientInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo)

Example 5 with GlusterClientInfo

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo in project ovirt-engine by oVirt.

the class VolumeBrickListModel method onShowBrickAdvancedDetails.

private void onShowBrickAdvancedDetails(GlusterVolumeEntity volumeEntity) {
    final GlusterBrickEntity brickEntity = getSelectedItem();
    final BrickAdvancedDetailsModel brickModel = new BrickAdvancedDetailsModel();
    setWindow(brickModel);
    brickModel.setTitle(ConstantsManager.getInstance().getConstants().advancedDetailsBrickTitle());
    brickModel.setHelpTag(HelpTag.brick_advanced);
    // $NON-NLS-1$
    brickModel.setHashName("brick_advanced");
    brickModel.startProgress();
    AsyncDataProvider.getInstance().getGlusterVolumeBrickDetails(new AsyncQuery<QueryReturnValue>(returnValue -> {
        brickModel.stopProgress();
        if (returnValue == null || !returnValue.getSucceeded()) {
            brickModel.setMessage(ConstantsManager.getInstance().getConstants().errorInFetchingBrickAdvancedDetails());
            return;
        }
        GlusterVolumeAdvancedDetails advDetails = returnValue.getReturnValue();
        brickModel.getBrick().setEntity(brickEntity.getQualifiedName());
        if (advDetails != null && advDetails.getBrickDetails() != null && advDetails.getBrickDetails().size() == 1) {
            BrickDetails brickDetails = advDetails.getBrickDetails().get(0);
            brickModel.getBrickProperties().setProperties(brickDetails.getBrickProperties());
            ArrayList<EntityModel<GlusterClientInfo>> clients = new ArrayList<>();
            for (GlusterClientInfo client : brickDetails.getClients()) {
                clients.add(new EntityModel<>(client));
            }
            brickModel.getClients().setItems(clients);
            brickModel.getMemoryStatistics().updateMemoryStatistics(brickDetails.getMemoryStatus().getMallInfo());
            ArrayList<EntityModel<Mempool>> memoryPools = new ArrayList<>();
            for (Mempool mempool : brickDetails.getMemoryStatus().getMemPools()) {
                memoryPools.add(new EntityModel<>(mempool));
            }
            brickModel.getMemoryPools().setItems(memoryPools);
        }
    }, true), volumeEntity.getClusterId(), volumeEntity.getId(), brickEntity.getId());
    // $NON-NLS-1$
    UICommand command = new UICommand("Cancel", this);
    command.setTitle(ConstantsManager.getInstance().getConstants().close());
    command.setIsCancel(true);
    brickModel.getCommands().add(command);
}
Also used : GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) HashMap(java.util.HashMap) GlusterVolumeReplaceBrickActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeReplaceBrickActionParameters) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GetConfigurationValueParameters(org.ovirt.engine.core.common.queries.GetConfigurationValueParameters) Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) GlusterVolumeRemoveBricksParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters) VolumeListModel(org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterClientInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo) JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) GlusterVolumeBricksActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeBricksActionParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Iterator(java.util.Iterator) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) GlusterVolumeResetBrickActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeResetBrickActionParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) GlusterClientInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool)

Aggregations

GlusterClientInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo)5 ArrayList (java.util.ArrayList)3 Map (java.util.Map)2 BrickDetails (org.ovirt.engine.core.common.businessentities.gluster.BrickDetails)2 Mempool (org.ovirt.engine.core.common.businessentities.gluster.Mempool)2 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 GlusterBrick (org.ovirt.engine.api.model.GlusterBrick)1 GlusterClients (org.ovirt.engine.api.model.GlusterClients)1 GlusterMemoryPools (org.ovirt.engine.api.model.GlusterMemoryPools)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 VDS (org.ovirt.engine.core.common.businessentities.VDS)1