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);
}
});
}
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());
}
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;
}
}
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;
}
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;
}
Aggregations