Search in sources :

Example 1 with GlusterVolumeVDSParameters

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

the class DeleteAllGlusterVolumeSnapshotsCommand method deleteAllGlusterVolumeSnapshots.

private boolean deleteAllGlusterVolumeSnapshots(Guid serverId, String volumeName, List<GlusterVolumeSnapshotEntity> snapshotsList) {
    VDSReturnValue retVal = runVdsCommand(VDSCommandType.DeleteAllGlusterVolumeSnapshots, new GlusterVolumeVDSParameters(serverId, volumeName));
    setSucceeded(retVal.getSucceeded());
    if (!getSucceeded()) {
        handleVdsError(AuditLogType.GLUSTER_VOLUME_ALL_SNAPSHOTS_DELETE_FAILED, retVal.getVdsError().getMessage());
    } else {
        List<Guid> guids = new ArrayList<>();
        for (GlusterVolumeSnapshotEntity snapshot : snapshotsList) {
            guids.add(snapshot.getId());
        }
        glusterVolumeSnapshotDao.removeAll(guids);
    }
    return true;
}
Also used : GlusterVolumeSnapshotEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) GlusterVolumeVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 2 with GlusterVolumeVDSParameters

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

the class StartGlusterVolumeProfileCommand method executeCommand.

@Override
protected void executeCommand() {
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.StartGlusterVolumeProfile, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName()));
    setSucceeded(returnValue.getSucceeded());
    if (!getSucceeded()) {
        handleVdsError(AuditLogType.GLUSTER_VOLUME_PROFILE_START_FAILED, returnValue.getVdsError().getMessage());
    }
}
Also used : GlusterVolumeVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 3 with GlusterVolumeVDSParameters

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

the class StopGlusterVolumeProfileCommand method executeCommand.

@Override
protected void executeCommand() {
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.StopGlusterVolumeProfile, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName()));
    setSucceeded(returnValue.getSucceeded());
    if (!getSucceeded()) {
        handleVdsError(AuditLogType.GLUSTER_VOLUME_PROFILE_STOP_FAILED, returnValue.getVdsError().getMessage());
    }
}
Also used : GlusterVolumeVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 4 with GlusterVolumeVDSParameters

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

the class StopRebalanceGlusterVolumeCommand method executeCommand.

@Override
protected void executeCommand() {
    VDSReturnValue vdsReturnaValue = runVdsCommand(VDSCommandType.StopRebalanceGlusterVolume, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName()));
    if (!vdsReturnaValue.getSucceeded()) {
        handleVdsError(AuditLogType.GLUSTER_VOLUME_REBALANCE_STOP_FAILED, vdsReturnaValue.getVdsError().getMessage());
        setSucceeded(false);
        return;
    }
    GlusterVolumeTaskStatusEntity rebalanceStatusEntity = (GlusterVolumeTaskStatusEntity) vdsReturnaValue.getReturnValue();
    JobExecutionStatus stepStatus = rebalanceStatusEntity.getStatusSummary().getStatus();
    if (stepStatus != null) {
        endStepJob(stepStatus, getStepMessageMap(stepStatus, glusterTaskUtils.getSummaryMessage(rebalanceStatusEntity.getStatusSummary())), glusterTaskUtils.isTaskSuccess(stepStatus));
    } else {
        endStepJob(JobExecutionStatus.ABORTED, getStepMessageMap(JobExecutionStatus.ABORTED, null), false);
    }
    releaseVolumeLock();
    setSucceeded(vdsReturnaValue.getSucceeded());
    getReturnValue().setActionReturnValue(rebalanceStatusEntity);
}
Also used : JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) GlusterVolumeVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 5 with GlusterVolumeVDSParameters

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

the class DeleteGlusterVolumeCommand method executeCommand.

@Override
protected void executeCommand() {
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.DeleteGlusterVolume, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName()));
    setSucceeded(returnValue.getSucceeded());
    if (getSucceeded()) {
        updateVolumeStatusInDb(getParameters().getVolumeId());
    } else {
        handleVdsError(AuditLogType.GLUSTER_VOLUME_DELETE_FAILED, returnValue.getVdsError().getMessage());
        return;
    }
}
Also used : GlusterVolumeVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Aggregations

VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)5 GlusterVolumeVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeVDSParameters)5 ArrayList (java.util.ArrayList)1 GlusterVolumeSnapshotEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity)1 GlusterVolumeTaskStatusEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity)1 JobExecutionStatus (org.ovirt.engine.core.common.job.JobExecutionStatus)1 Guid (org.ovirt.engine.core.compat.Guid)1