Search in sources :

Example 1 with GlusterVolumeRemoveBricksVDSParameters

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

the class CommitRemoveGlusterVolumeBricksCommand method executeCommand.

@Override
protected void executeCommand() {
    GlusterVolumeEntity volume = getGlusterVolume();
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.CommitRemoveGlusterVolumeBricks, new GlusterVolumeRemoveBricksVDSParameters(getUpServer().getId(), volume.getName(), getParameters().getBricks()));
    setSucceeded(returnValue.getSucceeded());
    if (!getSucceeded()) {
        handleVdsError(AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS_COMMIT_FAILED, returnValue.getVdsError().getMessage());
        return;
    }
    addCustomValue(GlusterConstants.NO_OF_BRICKS, String.valueOf(getParameters().getBricks().size()));
    endStepJobCommitted();
    glusterDBUtils.removeBricksFromVolumeInDb(volume, getParameters().getBricks(), getParameters().getReplicaCount());
    glusterVolumeDao.updateVolumeTask(volume.getId(), null);
    releaseVolumeLock();
    getReturnValue().setActionReturnValue(returnValue.getReturnValue());
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeRemoveBricksVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeRemoveBricksVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 2 with GlusterVolumeRemoveBricksVDSParameters

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

the class GlusterVolumeRemoveBricksCommand method executeCommand.

@Override
protected void executeCommand() {
    int replicaCount = (getGlusterVolume().getVolumeType() == GlusterVolumeType.REPLICATE || getGlusterVolume().getVolumeType() == GlusterVolumeType.DISTRIBUTED_REPLICATE) ? getParameters().getReplicaCount() : 0;
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.StartRemoveGlusterVolumeBricks, new GlusterVolumeRemoveBricksVDSParameters(upServer.getId(), getGlusterVolumeName(), getParameters().getBricks(), replicaCount, true));
    setSucceeded(returnValue.getSucceeded());
    if (getSucceeded()) {
        glusterDBUtils.removeBricksFromVolumeInDb(getGlusterVolume(), getParameters().getBricks(), replicaCount);
    } else {
        handleVdsError(AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS_FAILED, returnValue.getVdsError().getMessage());
        return;
    }
}
Also used : GlusterVolumeRemoveBricksVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeRemoveBricksVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 3 with GlusterVolumeRemoveBricksVDSParameters

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

the class StartRemoveGlusterVolumeBricksCommand method executeCommand.

@Override
protected void executeCommand() {
    int replicaCount = getGlusterVolume().getVolumeType().isReplicatedType() ? getParameters().getReplicaCount() : 0;
    startSubStep();
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.StartRemoveGlusterVolumeBricks, new GlusterVolumeRemoveBricksVDSParameters(upServer.getId(), getGlusterVolumeName(), getParameters().getBricks(), replicaCount, false));
    setSucceeded(returnValue.getSucceeded());
    if (!getSucceeded()) {
        handleVdsError(AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS_FAILED, returnValue.getVdsError().getMessage());
        return;
    }
    GlusterAsyncTask glusterTask = (GlusterAsyncTask) returnValue.getReturnValue();
    handleTaskReturn(glusterTask);
    updateBricksWithTaskID(glusterTask);
    getReturnValue().setActionReturnValue(returnValue.getReturnValue());
}
Also used : GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) GlusterVolumeRemoveBricksVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeRemoveBricksVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 4 with GlusterVolumeRemoveBricksVDSParameters

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

the class GetGlusterVolumeRemoveBricksStatusQuery method fetchTaskStatusDetails.

@Override
protected GlusterVolumeTaskStatusEntity fetchTaskStatusDetails() {
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRemoveBricksStatus, new GlusterVolumeRemoveBricksVDSParameters(getUpServerId(clusterId), volume.getName(), getParameters().getBricks(), volume.getReplicaCount()));
    GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity) returnValue.getReturnValue();
    // Update the latest status details
    GlusterAsyncTask asyncTask = volume.getAsyncTask();
    if (asyncTask != null) {
        // take a copy of the task status with engine for further use
        JobExecutionStatus jobStatusWithEngine = volume.getAsyncTask().getStatus();
        // update the status entity with required details
        updateStatusEntity(entity);
        // be set to aborted. This is required only in case of remove bricks
        if (jobStatusWithEngine == JobExecutionStatus.ABORTED) {
            entity.getStatusSummary().setStatus(JobExecutionStatus.ABORTED);
        }
    }
    return entity;
}
Also used : JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) GlusterVolumeRemoveBricksVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeRemoveBricksVDSParameters) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 5 with GlusterVolumeRemoveBricksVDSParameters

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

the class StopRemoveGlusterVolumeBricksCommand method executeCommand.

@Override
protected void executeCommand() {
    GlusterVolumeEntity volume = getGlusterVolume();
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.StopRemoveGlusterVolumeBricks, new GlusterVolumeRemoveBricksVDSParameters(getUpServer().getId(), volume.getName(), getParameters().getBricks()));
    setSucceeded(returnValue.getSucceeded());
    if (!getSucceeded()) {
        handleVdsError(AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS_FAILED, returnValue.getVdsError().getMessage());
        return;
    }
    GlusterVolumeTaskStatusEntity rebalanceStatusEntity = (GlusterVolumeTaskStatusEntity) returnValue.getReturnValue();
    endStepJobAborted(glusterTaskUtils.getSummaryMessage(rebalanceStatusEntity.getStatusSummary()));
    releaseVolumeLock();
    getReturnValue().setActionReturnValue(rebalanceStatusEntity);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeRemoveBricksVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeRemoveBricksVDSParameters) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Aggregations

VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)5 GlusterVolumeRemoveBricksVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeRemoveBricksVDSParameters)5 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)2 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)2 GlusterVolumeTaskStatusEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity)2 JobExecutionStatus (org.ovirt.engine.core.common.job.JobExecutionStatus)1