Search in sources :

Example 11 with GlusterVolumeGeoRepSessionVDSParameters

use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters in project ovirt-engine by oVirt.

the class GetGlusterVolumeGeoRepSessionStatusVDSCommand method executeVdsBrokerCommand.

@Override
protected void executeVdsBrokerCommand() {
    GlusterVolumeGeoRepSessionVDSParameters parameter = getParameters();
    result = getBroker().glusterVolumeGeoRepSessionStatus(parameter.getVolumeName(), parameter.getSlaveHost(), parameter.getSlaveVolume(), parameter.getUserName());
    proceedProxyReturnValue();
    if (getVDSReturnValue().getSucceeded()) {
        setReturnValue(result.getGeoRepDetails());
    }
}
Also used : GlusterVolumeGeoRepSessionVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters)

Example 12 with GlusterVolumeGeoRepSessionVDSParameters

use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters in project ovirt-engine by oVirt.

the class CreateGlusterVolumeGeoRepSessionVDSCommand method executeVdsBrokerCommand.

@Override
protected void executeVdsBrokerCommand() {
    GlusterVolumeGeoRepSessionVDSParameters parameters = getParameters();
    status = getBroker().glusterVolumeGeoRepSessionCreate(parameters.getVolumeName(), parameters.getSlaveHost(), parameters.getSlaveVolume(), parameters.getUserName(), parameters.getForce());
    proceedProxyReturnValue();
}
Also used : GlusterVolumeGeoRepSessionVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters)

Example 13 with GlusterVolumeGeoRepSessionVDSParameters

use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters in project ovirt-engine by oVirt.

the class PauseGlusterVolumeGeoRepSessionVDSCommand method executeVdsBrokerCommand.

@Override
protected void executeVdsBrokerCommand() {
    GlusterVolumeGeoRepSessionVDSParameters parameters = getParameters();
    status = getBroker().glusterVolumeGeoRepSessionPause(parameters.getVolumeName(), parameters.getSlaveHost(), parameters.getSlaveVolume(), parameters.getUserName(), parameters.getForce());
    proceedProxyReturnValue();
}
Also used : GlusterVolumeGeoRepSessionVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters)

Example 14 with GlusterVolumeGeoRepSessionVDSParameters

use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters in project ovirt-engine by oVirt.

the class StartGlusterVolumeGeoRepCommand method executeCommand.

@Override
protected void executeCommand() {
    GlusterGeoRepSession session = getGeoRepSession();
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.StartGlusterVolumeGeoRep, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), getGlusterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), session.getUserName(), getParameters().isForce()));
    setSucceeded(returnValue.getSucceeded());
    if (getSucceeded()) {
        session.setStatus(GeoRepSessionStatus.INITIALIZING);
        glusterGeoRepDao.updateSession(session);
    } else {
        handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_START_FAILED_EXCEPTION, returnValue.getVdsError().getMessage());
        return;
    }
}
Also used : GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) GlusterVolumeGeoRepSessionVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 15 with GlusterVolumeGeoRepSessionVDSParameters

use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters in project ovirt-engine by oVirt.

the class AddBricksToGlusterVolumeCommand method postAddBrickHandleGeoRepCase.

private void postAddBrickHandleGeoRepCase(final List<GlusterBrickEntity> bricksList, final Set<Guid> newServerIds) {
    // newServerIds is the set of ids of the servers that were not part of the volume before this attempt of brick
    // addition.
    final GlusterVolumeEntity volume = getGlusterVolume();
    List<GlusterGeoRepSession> sessions = new ArrayList<>();
    // Get all sessions for which the volume is a master
    List<GlusterGeoRepSession> geoRepSessionsForVolumeAsMaster = glusterGeoRepDao.getGeoRepSessions(volume.getId());
    if (geoRepSessionsForVolumeAsMaster != null && !geoRepSessionsForVolumeAsMaster.isEmpty()) {
        sessions.addAll(geoRepSessionsForVolumeAsMaster);
    }
    // Get session for which the volume is a slave
    GlusterGeoRepSession geoRepSessionForVolumeAsSlave = glusterGeoRepDao.getGeoRepSessionBySlaveVolume(volume.getId());
    if (geoRepSessionForVolumeAsSlave != null) {
        sessions.add(geoRepSessionForVolumeAsSlave);
    }
    // If this volume is empty, nothing to do.
    if (sessions.isEmpty()) {
        return;
    }
    List<Callable<Boolean>> perSessionCallables = new ArrayList<>();
    for (final GlusterGeoRepSession currentSession : sessions) {
        perSessionCallables.add(() -> {
            // Ids of servers on which steps like mount broker setup and/or passwordless ssh need to be done.
            Set<Guid> serverIdsToPrep = new HashSet<>(newServerIds);
            // Assume current volume as master volume of current session
            GlusterVolumeEntity masterVolume = volume;
            boolean succeeded = true;
            addCustomValue(GlusterConstants.VOLUME_NAME, currentSession.getMasterVolumeName());
            addCustomValue(GlusterConstants.GEO_REP_SLAVE_VOLUME_NAME, currentSession.getSlaveVolumeName());
            addCustomValue(GlusterConstants.GEO_REP_USER, currentSession.getUserName());
            if (currentSession.getMasterVolumeId().equals(volume.getId())) {
                /*
                     * If the volume is master, and there are any new servers, serverIdsToPrep is a set of all slave
                     * servers. This is bcoz the new server's keys also need to be updated to all slave servers.
                     */
                serverIdsToPrep = getSlaveNodesSet(currentSession);
            } else {
                // If its slave and non-root session, do partial mount broker setup
                if (!currentSession.getUserName().equalsIgnoreCase("root")) {
                    succeeded = evaluateReturnValue(errorType, backend.runInternalAction(ActionType.SetupGlusterGeoRepMountBrokerInternal, new SetUpMountBrokerParameters(volume.getClusterId(), serverIdsToPrep, volume.getName(), currentSession.getUserName())));
                    if (succeeded) {
                        auditLogDirector.log(this, AuditLogType.GLUSTER_SETUP_GEOREP_MOUNT_BROKER);
                    }
                }
                /*
                     * If the assumption that current volume is master, is invalid, which will be known here, update
                     * master volume correctly.
                     */
                masterVolume = glusterVolumeDao.getById(currentSession.getMasterVolumeId());
            }
            if (succeeded) {
                succeeded = evaluateReturnValue(errorType, runInternalAction(ActionType.SetUpPasswordLessSSHInternal, new SetUpPasswordLessSSHParameters(masterVolume.getClusterId(), serverIdsToPrep, currentSession.getUserName())));
            }
            if (succeeded) {
                auditLogDirector.log(this, AuditLogType.SET_UP_PASSWORDLESS_SSH);
                succeeded = evaluateReturnValue(errorType, runVdsCommand(VDSCommandType.CreateGlusterVolumeGeoRepSession, new GlusterVolumeGeoRepSessionVDSParameters(glusterUtil.getRandomUpServer(masterVolume.getClusterId()).getId(), currentSession.getMasterVolumeName(), currentSession.getSlaveHostName(), currentSession.getSlaveVolumeName(), currentSession.getUserName(), true)));
            }
            if (currentSession.getStatus() == GeoRepSessionStatus.ACTIVE || currentSession.getStatus() == GeoRepSessionStatus.INITIALIZING) {
                succeeded = evaluateReturnValue(errorType, runInternalAction(ActionType.StartGlusterVolumeGeoRep, new GlusterVolumeGeoRepSessionParameters(currentSession.getMasterVolumeId(), currentSession.getId(), true)));
            }
            return succeeded;
        });
    }
    ThreadPoolUtil.invokeAll(perSessionCallables);
}
Also used : SetUpMountBrokerParameters(org.ovirt.engine.core.common.action.gluster.SetUpMountBrokerParameters) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) Callable(java.util.concurrent.Callable) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeGeoRepSessionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) GlusterVolumeGeoRepSessionVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters) SetUpPasswordLessSSHParameters(org.ovirt.engine.core.common.action.gluster.SetUpPasswordLessSSHParameters) HashSet(java.util.HashSet)

Aggregations

GlusterVolumeGeoRepSessionVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters)16 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)9 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)5 ArrayList (java.util.ArrayList)4 List (java.util.List)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)3 HashSet (java.util.HashSet)2 SetUpMountBrokerParameters (org.ovirt.engine.core.common.action.gluster.SetUpMountBrokerParameters)2 SetUpPasswordLessSSHParameters (org.ovirt.engine.core.common.action.gluster.SetUpPasswordLessSSHParameters)2 EngineException (org.ovirt.engine.core.common.errors.EngineException)2 Guid (org.ovirt.engine.core.compat.Guid)2 HashMap (java.util.HashMap)1 Callable (java.util.concurrent.Callable)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 GlusterVolumeGeoRepSessionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters)1 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)1