Search in sources :

Example 71 with VDSReturnValue

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

the class StopGeoRepSessionCommand method executeCommand.

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

Example 72 with VDSReturnValue

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

the class StopGlusterVolumeCommand method executeCommand.

@Override
protected void executeCommand() {
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.StopGlusterVolume, new GlusterVolumeActionVDSParameters(upServer.getId(), getGlusterVolumeName(), getParameters().isForceAction()));
    setSucceeded(returnValue.getSucceeded());
    if (getSucceeded()) {
        glusterDBUtils.updateVolumeStatus(getParameters().getVolumeId(), GlusterStatus.DOWN);
    } else {
        handleVdsError(AuditLogType.GLUSTER_VOLUME_STOP_FAILED, returnValue.getVdsError().getMessage());
        return;
    }
}
Also used : GlusterVolumeActionVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeActionVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 73 with VDSReturnValue

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

the class MergeSPMBaseCommand method executeSPMMergeCommand.

protected void executeSPMMergeCommand(VDSCommandType vdsCommandType) {
    getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getSubchainInfo().getImageGroupId()));
    SPMColdMergeVDSCommandParameters parameters = new SPMColdMergeVDSCommandParameters(getParameters().getStoragePoolId(), getParameters().getSubchainInfo());
    VDSReturnValue vdsReturnValue = runVdsCommand(vdsCommandType, parameters);
    if (vdsReturnValue.getSucceeded()) {
        Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand());
        getTaskIdList().add(createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId()));
        setSucceeded(true);
    }
}
Also used : EntityInfo(org.ovirt.engine.core.common.asynctasks.EntityInfo) SPMColdMergeVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.SPMColdMergeVDSCommandParameters) Guid(org.ovirt.engine.core.compat.Guid) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 74 with VDSReturnValue

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

the class RemoveImageCommand method executeCommand.

@Override
protected void executeCommand() {
    if (getDiskImage() != null) {
        try {
            Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand());
            VDSReturnValue vdsReturnValue = performDeleteImageVdsmOperation();
            getTaskIdList().add(createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getStorageDomainId()));
        } catch (EngineException e) {
            if (e.getErrorCode() == EngineError.ImageDoesNotExistInDomainError) {
                log.info("Disk '{}' doesn't exist on storage domain '{}', rolling forward", getDiskImage().getId(), getStorageDomainId());
            } else // In this case, Engine has to check whether image still exists on the storage or not.
            if (e.getErrorCode() == EngineError.ImageDeleteError && isImageRemovedFromStorage()) {
                log.info("Disk '{}' was deleted from storage domain '{}'", getDiskImage().getId(), getStorageDomainId());
            } else {
                throw e;
            }
        }
        if (getParameters().getParentCommand() != ActionType.RemoveVmFromImportExport && getParameters().getParentCommand() != ActionType.RemoveVmTemplateFromImportExport) {
            performImageDbOperations();
        }
    } else {
        log.warn("DiskImage is null, nothing to remove");
    }
    setSucceeded(true);
}
Also used : EngineException(org.ovirt.engine.core.common.errors.EngineException) Guid(org.ovirt.engine.core.compat.Guid) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 75 with VDSReturnValue

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

the class TransferDiskImageCommand method tearDownImage.

@Override
protected void tearDownImage(Guid vdsId) {
    try {
        VDSReturnValue vdsRetVal = runVdsCommand(VDSCommandType.TeardownImage, getImageActionsParameters(vdsId));
        if (!vdsRetVal.getSucceeded()) {
            EngineException engineException = new EngineException();
            engineException.setVdsError(vdsRetVal.getVdsError());
            throw engineException;
        }
    } catch (EngineException e) {
        DiskImage image = getDiskImage();
        log.warn("Failed to tear down image '{}' for image transfer session: {}", image, e.getVdsError());
        // Invoke log method directly rather than relying on infra, because teardown
        // failure may occur during command execution, e.g. if the upload is paused.
        addCustomValue("DiskAlias", image != null ? image.getDiskAlias() : "(unknown)");
        auditLogDirector.log(this, AuditLogType.TRANSFER_IMAGE_TEARDOWN_FAILED);
    }
}
Also used : EngineException(org.ovirt.engine.core.common.errors.EngineException) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Aggregations

VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)250 Guid (org.ovirt.engine.core.compat.Guid)65 ArrayList (java.util.ArrayList)43 VDS (org.ovirt.engine.core.common.businessentities.VDS)29 EngineException (org.ovirt.engine.core.common.errors.EngineException)29 Pair (org.ovirt.engine.core.common.utils.Pair)26 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)23 List (java.util.List)16 Test (org.junit.Test)15 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)15 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)15 VdsIdVDSCommandParametersBase (org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase)15 HashMap (java.util.HashMap)13 VDSError (org.ovirt.engine.core.common.errors.VDSError)13 Map (java.util.Map)11 Callable (java.util.concurrent.Callable)11 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)11 StoragePoolIsoMap (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap)11 EngineLock (org.ovirt.engine.core.utils.lock.EngineLock)9 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)8