Search in sources :

Example 6 with GlusterGeoRepSession

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

the class DeleteAllGlusterVolumeSnapshotsCommand method executeCommand.

@Override
public void executeCommand() {
    if (georepSessions != null) {
        for (GlusterGeoRepSession session : georepSessions) {
            GlusterVolumeEntity slaveVolume = glusterVolumeDao.getById(session.getSlaveVolumeId());
            if (slaveVolume == null) {
                // continue with other sessions and try to pause
                continue;
            }
            VDS slaveUpServer = glusterUtil.getRandomUpServer(slaveVolume.getClusterId());
            if (slaveUpServer == null) {
                handleVdsError(AuditLogType.GLUSTER_VOLUME_ALL_SNAPSHOTS_DELETE_FAILED, EngineError.NoUpServerFoundInRemoteCluster.name());
                setSucceeded(false);
                return;
            }
            List<GlusterVolumeSnapshotEntity> slaveVolumeSnapshots = glusterVolumeSnapshotDao.getAllByVolumeId(slaveVolume.getId());
            try (EngineLock lock = acquireEngineLock(session.getSlaveVolumeId(), LockingGroup.GLUSTER_SNAPSHOT)) {
                if (!deleteAllGlusterVolumeSnapshots(slaveUpServer.getId(), slaveVolume.getName(), slaveVolumeSnapshots)) {
                    return;
                }
                // Check and remove soft limit alert for the volume
                glusterUtil.checkAndRemoveVolumeSnapshotLimitsAlert(slaveVolume);
            }
        }
    }
    deleteAllGlusterVolumeSnapshots(getUpServer().getId(), getGlusterVolumeName(), snapshots);
    // Check and remove soft limit alert for the volume
    glusterUtil.checkAndRemoveVolumeSnapshotLimitsAlert(getGlusterVolume());
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeSnapshotEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) EngineLock(org.ovirt.engine.core.utils.lock.EngineLock)

Example 7 with GlusterGeoRepSession

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

the class DeleteGlusterVolumeSnapshotCommand method executeCommand.

@Override
public void executeCommand() {
    if (georepSessions != null) {
        for (GlusterGeoRepSession session : georepSessions) {
            GlusterVolumeEntity slaveVolume = glusterVolumeDao.getById(session.getSlaveVolumeId());
            if (slaveVolume == null) {
                // continue with other sessions and try to pause
                continue;
            }
            VDS slaveUpServer = glusterUtil.getRandomUpServer(slaveVolume.getClusterId());
            if (slaveUpServer == null) {
                handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_DELETE_FAILED, EngineError.NoUpServerFoundInRemoteCluster.name());
                setSucceeded(false);
                return;
            }
            try (EngineLock lock = acquireEngineLock(session.getSlaveVolumeId(), LockingGroup.GLUSTER_SNAPSHOT)) {
                if (!deleteGlusterVolumeSnapshot(slaveUpServer.getId(), slaveVolume.getName(), getSnapshot().getSnapshotName())) {
                    return;
                }
                // Check and remove soft limit alert for the volume
                glusterUtil.checkAndRemoveVolumeSnapshotLimitsAlert(slaveVolume);
            }
        }
    }
    deleteGlusterVolumeSnapshot(getUpServer().getId(), getGlusterVolumeName(), getSnapshot().getSnapshotName());
    // Check and remove soft limit alert for the volume
    glusterUtil.checkAndRemoveVolumeSnapshotLimitsAlert(getGlusterVolume());
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) EngineLock(org.ovirt.engine.core.utils.lock.EngineLock)

Example 8 with GlusterGeoRepSession

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

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

Example 10 with GlusterGeoRepSession

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

the class VolumeGeoRepListModel method confirmGeoRepAction.

private void confirmGeoRepAction(String title, HelpTag helpTag, String hashName, String commandName, String action) {
    GlusterGeoRepSession selectedSession = getSelectedItem();
    if (selectedSession == null) {
        return;
    }
    initializeGeoRepActionConfirmation(title, helpTag, hashName, null, null, commandName, selectedSession.getMasterVolumeName(), selectedSession.getSlaveVolumeName(), selectedSession.getSlaveHostName(), messages.geoRepActionConfirmationMessage(action));
}
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