Search in sources :

Example 6 with GlusterGeoRepSessionDetails

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

the class VolumeGeoRepListModel method showGeoRepSessionDetails.

public void showGeoRepSessionDetails(GlusterGeoRepSession session) {
    ArrayList<GlusterGeoRepSessionDetails> details = session.getSessionDetails();
    if (getWindow() != null) {
        return;
    }
    if (details == null || details.size() == 0) {
        final UIConstants constants = ConstantsManager.getInstance().getConstants();
        final ConfirmationModel cModel = new ConfirmationModel();
        cModel.setTitle(constants.geoReplicationSessionDetailsTitle());
        // $NON-NLS-1$
        UICommand okCommand = new UICommand("closeConfirmWindow", this);
        okCommand.setTitle(constants.ok());
        okCommand.setIsCancel(true);
        cModel.getCommands().add(okCommand);
        setConfirmWindow(cModel);
        cModel.setMessage(constants.geoRepSessionStatusDetailFetchFailed());
    } else {
        populateStatus(details);
    }
}
Also used : GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants)

Example 7 with GlusterGeoRepSessionDetails

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

the class GlusterGeoRepDaoImpl method saveOrUpdateDetailsInBatch.

@Override
public void saveOrUpdateDetailsInBatch(List<GlusterGeoRepSessionDetails> geoRepSessionDetailsObjs) {
    List<GlusterGeoRepSessionDetails> insertList = new ArrayList<>();
    List<GlusterGeoRepSessionDetails> updateList = new ArrayList<>();
    for (GlusterGeoRepSessionDetails details : geoRepSessionDetailsObjs) {
        if (getGeoRepSessionDetails(details.getSessionId(), details.getMasterBrickId()) == null) {
            insertList.add(details);
        } else {
            updateList.add(details);
        }
    }
    saveDetailsInBatch(insertList);
    updateDetailsInBatch(updateList);
}
Also used : ArrayList(java.util.ArrayList) GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails)

Example 8 with GlusterGeoRepSessionDetails

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

the class GlusterGeoRepSyncJobTest method getSessionDetailsList.

private ArrayList<GlusterGeoRepSessionDetails> getSessionDetailsList() {
    ArrayList<GlusterGeoRepSessionDetails> list = new ArrayList<>();
    GlusterGeoRepSessionDetails details = new GlusterGeoRepSessionDetails();
    details.setMasterBrickId(Guid.newGuid());
    list.add(details);
    return list;
}
Also used : ArrayList(java.util.ArrayList) GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails)

Example 9 with GlusterGeoRepSessionDetails

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

the class GlusterGeoRepDaoTest method testUpdateDetails.

@Test
public void testUpdateDetails() {
    GlusterGeoRepSessionDetails sessionDetails = getGlusterGeoRepSessionDetails();
    dao.saveDetails(sessionDetails);
    Long entryOpsPending = 567888L;
    Long dataOpsPending = 50L;
    sessionDetails.setEntryOpsPending(entryOpsPending);
    sessionDetails.setCheckPointStatus("NEW");
    sessionDetails.setDataOpsPending(dataOpsPending);
    dao.updateDetails(sessionDetails);
    List<GlusterGeoRepSessionDetails> fetchedSessionDetails = dao.getGeoRepSessionDetails(FixturesTool.GLUSTER_GEOREP_SESSION_ID);
    assertEquals(entryOpsPending, fetchedSessionDetails.get(0).getEntryOpsPending());
    assertEquals(dataOpsPending, fetchedSessionDetails.get(0).getDataOpsPending());
    assertEquals("NEW", fetchedSessionDetails.get(0).getCheckPointStatus());
}
Also used : GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails) Test(org.junit.Test)

Example 10 with GlusterGeoRepSessionDetails

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

the class GetGlusterVolumeGeoRepSessionsQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    List<GlusterGeoRepSession> geoRepSessions = glusterGeoRepDao.getGeoRepSessions(getParameters().getId());
    /*
         * If master volume has sessions, update the master server names in accordance with masterBrickId in sessionDetails.
         */
    if (geoRepSessions != null) {
        for (GlusterGeoRepSession currentSession : geoRepSessions) {
            // For each session get corresponding session details.
            List<GlusterGeoRepSessionDetails> geoRepSessionDetails = glusterGeoRepDao.getGeoRepSessionDetails(currentSession.getId());
            /*
                 * Session details could be null, if they are not yet synced. possible if session detail command failed for some unexpected reason
                 * such as network failure even though the sessions in the cluster are synced(sessionListCommand)
                 */
            if (geoRepSessionDetails == null) {
                continue;
            }
            /*
                 * If non null session detail, set masterBrick servername in accordance with that in brick
                 * as obtained by using masterbrickId
                 */
            for (GlusterGeoRepSessionDetails currentDetail : geoRepSessionDetails) {
                if (currentDetail == null) {
                    continue;
                }
                Guid currentMasterBrickId = currentDetail.getMasterBrickId();
                if (currentMasterBrickId == null) {
                    continue;
                }
                GlusterBrickEntity currentBrick = glusterBrickDao.getById(currentMasterBrickId);
                if (currentBrick != null) {
                    currentDetail.setMasterBrickHostName(currentBrick.getServerName());
                }
            }
            /*
                 * Finally set session details to the current session
                 */
            currentSession.setSessionDetails((ArrayList<GlusterGeoRepSessionDetails>) geoRepSessionDetails);
        }
    }
    getQueryReturnValue().setReturnValue(geoRepSessions);
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails) Guid(org.ovirt.engine.core.compat.Guid)

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