Search in sources :

Example 26 with GlusterGeoRepSession

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

the class GetGlusterVolumeGeoRepSessionByIdQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    GlusterGeoRepSession geoRepSession = glusterGeoRepDao.getById(getParameters().getId());
    getQueryReturnValue().setReturnValue(geoRepSession);
}
Also used : GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)

Example 27 with GlusterGeoRepSession

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession 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)

Example 28 with GlusterGeoRepSession

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

the class GlusterGeoRepSyncJobTest method getSession.

private GlusterGeoRepSession getSession(boolean populateVoId) {
    GlusterGeoRepSession session = new GlusterGeoRepSession();
    session.setMasterVolumeName("VOL1");
    if (populateVoId) {
        session.setMasterVolumeId(Guid.newGuid());
    }
    session.setId(Guid.newGuid());
    session.setSessionKey(session.getId() + session.getMasterVolumeName());
    session.setStatus(GeoRepSessionStatus.ACTIVE);
    session.setSessionDetails(getSessionDetailsList());
    return session;
}
Also used : GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)

Example 29 with GlusterGeoRepSession

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

the class GetGlusterVolumeGeoRepSessionsQueryTest method getMockGeoRepSessions.

private List<GlusterGeoRepSession> getMockGeoRepSessions() {
    List<GlusterGeoRepSession> sessions = new ArrayList<>();
    GlusterGeoRepSession session = new GlusterGeoRepSession();
    session.setId(sessionId);
    session.setMasterVolumeId(masterVolumeId);
    session.setSessionKey("");
    session.setSlaveHostName("slave-host-1");
    session.setSlaveVolumeId(slaveVolumeId);
    session.setSlaveNodeUuid(slaveNodeUuid);
    session.setSlaveVolumeName("");
    session.setStatus(GeoRepSessionStatus.ACTIVE);
    sessions.add(session);
    return sessions;
}
Also used : ArrayList(java.util.ArrayList) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)

Example 30 with GlusterGeoRepSession

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

the class PauseGlusterVolumeGeoRepSessionCommandTest method getGeoRepSession.

protected GlusterGeoRepSession getGeoRepSession(Guid gSessionId, GeoRepSessionStatus status, Guid masterVolumeID) {
    GlusterGeoRepSession session = super.getGeoRepSession(gSessionId, status);
    session.setMasterVolumeId(startedVolumeId);
    return session;
}
Also used : GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)

Aggregations

GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)49 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)12 EngineLock (org.ovirt.engine.core.utils.lock.EngineLock)9 GlusterVolumeGeoRepSessionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters)8 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)8 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)6 VDS (org.ovirt.engine.core.common.businessentities.VDS)6 Guid (org.ovirt.engine.core.compat.Guid)6 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)5 GlusterVolumeGeoRepSessionVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters)5 GlusterGeoRepSessionDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails)3 GlusterVolumeSnapshotEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity)3 HashMap (java.util.HashMap)2 Callable (java.util.concurrent.Callable)2 StorageDomainDR (org.ovirt.engine.core.common.businessentities.StorageDomainDR)2 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)2 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)2 EngineException (org.ovirt.engine.core.common.errors.EngineException)2 CreateGlusterVolumeSnapshotVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.CreateGlusterVolumeSnapshotVDSParameters)2