Search in sources :

Example 1 with GlusterGeoRepSessionDetails

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

the class VolumeGeoRepSessionDetailsPopUpPresenterWidget method init.

@Override
public void init(final VolumeGeoRepSessionDetailsModel model) {
    super.init(model);
    model.getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if (args.propertyName.equalsIgnoreCase("selectedSessionSummaryRow")) {
            // $NON-NLS-1$
            GlusterGeoRepSessionDetails selectedSessionDetail = model.getGeoRepSessionSummary().getSelectedItem().getEntity();
            getView().setCheckPointCompletedAtVisibility(selectedSessionDetail.isCheckpointCompleted());
            getView().updateSessionDetailProperties(selectedSessionDetail);
        }
    });
}
Also used : GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails)

Example 2 with GlusterGeoRepSessionDetails

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

the class VolumeGeoRepSessionDetailsPopUpView method intiEditors.

private void intiEditors(final ApplicationConstants constants) {
    checkPointStatus = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {

        @Override
        public String render(GlusterGeoRepSessionDetails object) {
            String checkPointStatusValue = object.getCheckPointStatus();
            return checkPointStatusValue == null || checkPointStatusValue.isEmpty() ? constants.notAvailableLabel() : checkPointStatusValue;
        }
    });
    crawlStatus = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {

        @Override
        public String render(GlusterGeoRepSessionDetails object) {
            return object.getCrawlStatus().toString();
        }
    });
    dataOpsPending = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {

        @Override
        public String render(GlusterGeoRepSessionDetails object) {
            return object.getDataOpsPending().toString();
        }
    });
    metaOpsPending = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {

        @Override
        public String render(GlusterGeoRepSessionDetails object) {
            return object.getMetaOpsPending().toString();
        }
    });
    entryOpsPending = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {

        @Override
        public String render(GlusterGeoRepSessionDetails object) {
            return object.getEntryOpsPending().toString();
        }
    });
    failures = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {

        @Override
        public String render(GlusterGeoRepSessionDetails object) {
            return object.getFailures().toString();
        }
    });
    checkPointTime = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {

        @Override
        public String render(GlusterGeoRepSessionDetails object) {
            return new FullDateTimeRenderer().render(object.getCheckPointTime());
        }
    });
    checkPointCompletedAt = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {

        @Override
        public String render(GlusterGeoRepSessionDetails object) {
            return new FullDateTimeRenderer().render(object.getCheckPointCompletedAt());
        }
    });
    geoRepSessionSummaryTable = new EntityModelCellTable<>(false, true);
    geoRepSessionSummaryTable.addColumn(new AbstractEntityModelTextColumn<GlusterGeoRepSessionDetails>() {

        @Override
        public String getText(GlusterGeoRepSessionDetails object) {
            return object.getMasterBrickHostName() == null ? constants.notAvailableLabel() : object.getMasterBrickHostName();
        }
    }, constants.geoRepSessionHostName());
    geoRepSessionSummaryTable.addColumn(new AbstractEntityModelTextColumn<GlusterGeoRepSessionDetails>() {

        @Override
        protected String getText(GlusterGeoRepSessionDetails entity) {
            return (entity == null || entity.getStatus() == null) ? constants.notAvailableLabel() : entity.getStatus().toString();
        }
    }, constants.geoRepSessionStatus());
    geoRepSessionSummaryTable.addColumn(new AbstractFullDateTimeColumn<EntityModel<GlusterGeoRepSessionDetails>>() {

        @Override
        protected Date getRawValue(EntityModel<GlusterGeoRepSessionDetails> object) {
            GlusterGeoRepSessionDetails sessionDetail = object.getEntity();
            return (sessionDetail == null || sessionDetail.getLastSyncedAt() == null) ? new Date() : sessionDetail.getLastSyncedAt();
        }
    }, constants.geoRepLastSyncedAt());
}
Also used : FullDateTimeRenderer(org.ovirt.engine.ui.common.widget.renderer.FullDateTimeRenderer) AbstractRenderer(com.google.gwt.text.shared.AbstractRenderer) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails) Date(java.util.Date)

Example 3 with GlusterGeoRepSessionDetails

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

the class GlusterStorageGeoRepSyncCallback method evaluateGeoRepSessionStatus.

private void evaluateGeoRepSessionStatus(CommandBase<?> rootCommand) {
    GlusterVolumeGeoRepSessionParameters parameters = (GlusterVolumeGeoRepSessionParameters) rootCommand.getParameters();
    GlusterGeoRepSession session = geoRepDao.getById(parameters.getGeoRepSessionId());
    if (session == null) {
        rootCommand.setCommandStatus(CommandStatus.FAILED);
        return;
    }
    session.setSessionDetails((ArrayList<GlusterGeoRepSessionDetails>) geoRepDao.getGeoRepSessionDetails(session.getId()));
    switch(session.getStatus()) {
        case ACTIVE:
            // check if checkpoint is completed
            if (session.isCheckPointCompleted()) {
                // stop the geo-rep session
                stopGeoRepSessionCommand(rootCommand, session);
                rootCommand.setCommandStatus(CommandStatus.SUCCEEDED);
            }
            break;
        case FAULTY:
            rootCommand.setCommandStatus(CommandStatus.FAILED);
        default:
            break;
    }
}
Also used : GlusterVolumeGeoRepSessionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails)

Example 4 with GlusterGeoRepSessionDetails

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

the class GlusterVolumeGeoRepStatus method getSessionDetails.

protected GlusterGeoRepSessionDetails getSessionDetails(Map<String, Object> innerMap) {
    GlusterGeoRepSessionDetails details = new GlusterGeoRepSessionDetails();
    Guid masterNodeGlusterId;
    if (innerMap.containsKey(HOST_UUID)) {
        masterNodeGlusterId = new Guid(innerMap.get(HOST_UUID).toString());
    } else {
        log.error("Master node uuid is not available");
        return null;
    }
    String masterBrickDir = innerMap.containsKey(BRICK_NAME) ? innerMap.get(BRICK_NAME).toString() : null;
    GlusterServer glusterServer = getDbUtils().getServerByUuid(masterNodeGlusterId);
    if (glusterServer != null) {
        GlusterBrickEntity brick = getDbUtils().getGlusterBrickByServerUuidAndBrickDir(glusterServer.getId(), masterBrickDir);
        if (brick != null) {
            details.setMasterBrickId(brick.getId());
        }
    }
    if (details.getMasterBrickId() == null) {
        log.error("Brick information could not be retrieved for gluster host id {} and brick dir {}", masterNodeGlusterId, masterBrickDir);
    }
    String slave = innerMap.containsKey(REMOTE_HOST) ? innerMap.get(REMOTE_HOST).toString() : null;
    details.setSlaveHostName(slave);
    details.setStatus(GeoRepSessionStatus.from((String) innerMap.get(STATUS)));
    details.setCrawlStatus(GeoRepCrawlStatus.from((String) innerMap.get(CRAWL_STATUS)));
    details.setCheckPointStatus((String) innerMap.get(CHECK_POINT_STATUS));
    return details;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterServer(org.ovirt.engine.core.common.businessentities.gluster.GlusterServer) GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails) Guid(org.ovirt.engine.core.compat.Guid)

Example 5 with GlusterGeoRepSessionDetails

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

the class GlusterVolumeGeoRepStatus method populateSession.

private GlusterGeoRepSession populateSession(String volumeName, Map<String, Object> innerMap) {
    GlusterGeoRepSession geoRepSession = getSession(volumeName, innerMap);
    ArrayList<GlusterGeoRepSessionDetails> geoRepSessionDetails = new ArrayList<>();
    if (innerMap.containsKey(BRICKS)) {
        for (Object brickSession : (Object[]) innerMap.get(BRICKS)) {
            geoRepSessionDetails.add(getSessionDetails((Map<String, Object>) brickSession));
        }
    }
    geoRepSession.setSessionDetails(geoRepSessionDetails);
    return geoRepSession;
}
Also used : ArrayList(java.util.ArrayList) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails) Map(java.util.Map)

Aggregations

GlusterGeoRepSessionDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails)14 ArrayList (java.util.ArrayList)4 Date (java.util.Date)3 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)3 Test (org.junit.Test)2 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)2 Guid (org.ovirt.engine.core.compat.Guid)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)2 UIConstants (org.ovirt.engine.ui.uicompat.UIConstants)2 AbstractRenderer (com.google.gwt.text.shared.AbstractRenderer)1 Map (java.util.Map)1 GlusterVolumeGeoRepSessionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters)1 GlusterServer (org.ovirt.engine.core.common.businessentities.gluster.GlusterServer)1 FullDateTimeRenderer (org.ovirt.engine.ui.common.widget.renderer.FullDateTimeRenderer)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1