Search in sources :

Example 1 with GlusterVolumeGeoRepSessionVDSParameters

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

the class GlusterGeoRepSyncJob method getSessionDetailFromCLI.

private List<GlusterGeoRepSessionDetails> getSessionDetailFromCLI(Cluster cluster, GlusterGeoRepSession session) {
    VDS upServer = glusterUtil.getRandomUpServer(cluster.getId());
    if (upServer == null) {
        log.debug("No UP server found in cluster: {} for geo-rep monitoring", cluster.getName());
        return null;
    }
    try {
        VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeGeoRepSessionStatus, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), session.getUserName()));
        if (returnValue.getSucceeded()) {
            return (List<GlusterGeoRepSessionDetails>) returnValue.getReturnValue();
        } else {
            log.error("VDS error {}", returnValue.getVdsError().getMessage());
            log.debug("VDS error", returnValue.getVdsError());
            return null;
        }
    } catch (Exception e) {
        log.error("Exception getting geo-rep status from vds {}", e.getMessage());
        log.debug("Exception", e);
        return null;
    }
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterVolumeGeoRepSessionVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters) ArrayList(java.util.ArrayList) List(java.util.List) EngineException(org.ovirt.engine.core.common.errors.EngineException) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 2 with GlusterVolumeGeoRepSessionVDSParameters

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

the class GlusterGeoRepSyncJob method getSessionConfigFromCLI.

private List<GlusterGeoRepSessionConfiguration> getSessionConfigFromCLI(Cluster cluster, GlusterGeoRepSession session) {
    VDS upServer = glusterUtil.getRandomUpServer(cluster.getId());
    if (upServer == null) {
        log.debug("No UP server found in cluster: {} for geo-rep monitoring", cluster.getName());
        return null;
    }
    try {
        VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeGeoRepConfigList, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), session.getUserName()));
        if (returnValue.getSucceeded()) {
            return (List<GlusterGeoRepSessionConfiguration>) returnValue.getReturnValue();
        } else {
            log.error("VDS error {}", returnValue.getVdsError().getMessage());
            log.debug("VDS error", returnValue.getVdsError());
            return null;
        }
    } catch (Exception e) {
        log.error("Exception getting geo-rep status from vds {}", e.getMessage());
        log.debug("Exception", e);
        return null;
    }
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterVolumeGeoRepSessionVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters) ArrayList(java.util.ArrayList) List(java.util.List) EngineException(org.ovirt.engine.core.common.errors.EngineException) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 3 with GlusterVolumeGeoRepSessionVDSParameters

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

the class CreateGlusterVolumeGeoRepSessionCommand method executeCommand.

@Override
protected void executeCommand() {
    boolean rootSession = getParameters().getUserName().equalsIgnoreCase("root");
    boolean succeeded = true;
    Set<Guid> remoteServerIds = getServerIds(remoteServersSet);
    Guid slaveHostId = getParameters().getSlaveHostId();
    if (!rootSession) {
        ActionReturnValue completeMountBrokerSetupOnSlaveInternalAction = backend.runInternalAction(ActionType.SetupGlusterGeoRepMountBrokerInternal, new SetUpMountBrokerParameters(vdsDao.get(slaveHostId).getClusterId(), new HashSet<>(Collections.singletonList(getParameters().getSlaveHostId())), getParameters().getSlaveVolumeName(), getParameters().getUserName(), getParameters().getUserGroup()));
        succeeded = evaluateReturnValue(AuditLogType.GLUSTER_GEOREP_SETUP_MOUNT_BROKER_FAILED, completeMountBrokerSetupOnSlaveInternalAction);
        remoteServerIds.remove(slaveHostId);
        if (succeeded) {
            auditLogDirector.log(this, AuditLogType.GLUSTER_SETUP_GEOREP_MOUNT_BROKER);
            if (!remoteServerIds.isEmpty()) {
                ActionReturnValue mountBrokerPartialSetupInternalAction = backend.runInternalAction(ActionType.SetupGlusterGeoRepMountBrokerInternal, new SetUpMountBrokerParameters(vdsDao.get(slaveHostId).getClusterId(), remoteServerIds, getParameters().getSlaveVolumeName(), getParameters().getUserName()));
                succeeded = evaluateReturnValue(AuditLogType.GLUSTER_GEOREP_SETUP_MOUNT_BROKER_FAILED, mountBrokerPartialSetupInternalAction);
                if (succeeded) {
                    auditLogDirector.log(this, AuditLogType.GLUSTER_SETUP_GEOREP_MOUNT_BROKER);
                }
            }
        }
    }
    if (succeeded) {
        remoteServerIds.add(slaveHostId);
        ActionReturnValue setUpPasswordLessSSHinternalAction = runInternalAction(ActionType.SetUpPasswordLessSSHInternal, new SetUpPasswordLessSSHParameters(upServer.getClusterId(), remoteServerIds, getParameters().getUserName()));
        succeeded = evaluateReturnValue(errorType, setUpPasswordLessSSHinternalAction);
        if (succeeded) {
            auditLogDirector.log(this, AuditLogType.SET_UP_PASSWORDLESS_SSH);
            VDSReturnValue createVdsReturnValue = runVdsCommand(VDSCommandType.CreateGlusterVolumeGeoRepSession, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), getGlusterVolumeName(), vdsDao.get(slaveHostId).getHostName(), getParameters().getSlaveVolumeName(), getParameters().getUserName(), getParameters().isForce()));
            succeeded = evaluateReturnValue(AuditLogType.GLUSTER_GEOREP_SESSION_CREATE_FAILED, createVdsReturnValue);
            if (succeeded) {
                glusterGeoRepSyncJob.refreshGeoRepDataForVolume(getGlusterVolume());
            }
        }
    }
    setSucceeded(succeeded);
}
Also used : SetUpMountBrokerParameters(org.ovirt.engine.core.common.action.gluster.SetUpMountBrokerParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) GlusterVolumeGeoRepSessionVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters) Guid(org.ovirt.engine.core.compat.Guid) SetUpPasswordLessSSHParameters(org.ovirt.engine.core.common.action.gluster.SetUpPasswordLessSSHParameters) HashSet(java.util.HashSet) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 4 with GlusterVolumeGeoRepSessionVDSParameters

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

the class DeleteGeoRepSessionCommand method executeCommand.

@Override
protected void executeCommand() {
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.DeleteGlusterVolumeGeoRepSession, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), getGeoRepSession().getMasterVolumeName(), getGeoRepSession().getSlaveHostName(), getGeoRepSession().getSlaveVolumeName(), getGeoRepSession().getUserName()));
    setSucceeded(returnValue.getSucceeded());
    if (getSucceeded()) {
        glusterGeoRepDao.remove(getGeoRepSession().getId());
    } else {
        handleVdsError(AuditLogType.GEOREP_SESSION_DELETE_FAILED, returnValue.getVdsError().getMessage());
    }
}
Also used : GlusterVolumeGeoRepSessionVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepSessionVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 5 with GlusterVolumeGeoRepSessionVDSParameters

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

the class StartGlusterVolumeGeoRepVDSCommand method executeVdsBrokerCommand.

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

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