Search in sources :

Example 21 with VDSError

use of org.ovirt.engine.core.common.errors.VDSError in project ovirt-engine by oVirt.

the class BrokerCommandBase method proceedProxyReturnValue.

protected void proceedProxyReturnValue() {
    EngineError returnStatus = getReturnValueFromStatus(getReturnStatus());
    VDSExceptionBase outEx;
    switch(returnStatus) {
        case Done:
            return;
        case recovery:
            outEx = new VDSRecoveringException(returnStatus, getReturnStatus().message);
            break;
        case SpmStatusError:
            outEx = new IRSNonOperationalException(getReturnStatus().message);
            break;
        case StoragePoolMasterNotFound:
        case StoragePoolTooManyMasters:
        case StoragePoolWrongMaster:
        case StoragePoolHasPotentialMaster:
        case StorageDomainMasterError:
            outEx = new IRSNoMasterDomainException(getReturnStatus().message);
            break;
        case UnicodeArgumentException:
            outEx = new IRSUnicodeArgumentException(getReturnStatus().message);
            break;
        case TooManyDomainsInStoragePoolError:
        case StorageDomainAlreadyAttached:
        case StorageDomainDescriptionTooLongError:
        case TooManyPVsInVG:
        case createIllegalVolumeSnapshotError:
        case prepareIllegalVolumeError:
        case createVolumeRollbackError:
        case InvalidParameterException:
        case InvalidDefaultExceptionException:
        case NotImplementedException:
        case OperationInProgress:
        case MiscDirCleanupFailure:
        case createVolumeSizeError:
        case IncorrectFormat:
        case VolumeIsBusy:
        case VolumeImageHasChildren:
        case VolumeUnlinkError:
        case OrphanVolumeError:
        case VolumeAlreadyExists:
        case VolumeNonWritable:
        case VolumeNonShareable:
        case VolumeCannotGetParent:
        case SharedVolumeNonWritable:
        case InternalVolumeNonWritable:
        case CannotDeleteSharedVolume:
        case NonLeafVolumeNotWritable:
        case ImagesActionError:
        case ImageValidationError:
        case ImageDeleteError:
        case ImageIsNotEmpty:
        case ImageIsNotLegalChain:
        case OverwriteImageError:
        case MoveTemplateImageError:
        case StoragePoolDisconnectionError:
        case StoragePoolAlreadyExists:
        case IsoCannotBeMasterDomain:
        case CannotConnectMultiplePools:
        case BackupCannotBeMasterDomain:
        case StoragePoolConnected:
        case StoragePoolDescriptionTooLongError:
        case StorageDomainNotInPool:
        case StorageDomainNotEmpty:
        case StorageDomainMetadataCreationError:
        case StorageDomainMetadataFileMissing:
        case StorageDomainMetadataNotFound:
        case StorageDomainAlreadyExists:
        case StorageDomainMasterUnmountError:
        case BlockStorageDomainMasterFSCKError:
        case StorageDomainLayoutError:
        case StorageDomainTypeError:
        case StorageDomainNotMemberOfPool:
        case StorageDomainStatusError:
        case StorageDomainCheckError:
        case StorageDomainTypeNotBackup:
        case StorageDomainStateTransitionIllegal:
        case StorageDomainActive:
        case CannotDetachMasterStorageDomain:
        case StorageDomainInsufficientPermissions:
        case StorageDomainClassError:
        case StorageDomainIsMadeFromTooManyPVs:
        case InvalidTask:
        case UnknownTask:
        case TaskClearError:
        case TaskNotFinished:
        case InvalidTaskType:
        case AddTaskError:
        case TaskInProgress:
        case TaskStateError:
        case TaskAborted:
        case TaskPersistError:
        case InvalidJob:
        case InvalidRecovery:
        case InvalidTaskMng:
        case TaskStateTransitionError:
        case TaskHasRefs:
        case VolumeGroupSizeError:
        case VolumeGroupAlreadyExistsError:
        case VolumeGroupUninitialized:
        case VolumeGroupHasDomainTag:
        case CannotRemoveLogicalVolume:
        case CannotDeactivateLogicalVolume:
        case CannotActivateLogicalVolume:
        case LogicalVolumePermissionsError:
        case LogicalVolumeAlreadyExists:
        case PartitionedPhysDev:
        case DomainAlreadyLocked:
        case DomainLockDoesNotExist:
        case MetaDataKeyError:
        case MetaDataSealIsBroken:
        case MetaDataValidationError:
        case MetaDataMappingError:
        case MetaDataParamError:
        case MetadataOverflowError:
        case ImportUnknownType:
        case ExportError:
        case MergeVolumeRollbackError:
        case ActionStopped:
        case FAILED_CHANGE_CD_IS_MOUNTED:
        case UnsupportedDomainVersion:
        case CurrentVersionTooAdvancedError:
        case iSCSILogoutError:
        case iSCSIDiscoveryError:
        case ISCSI_LOGIN_AUTH_ERROR:
        case PoolUpgradeInProgress:
        case MixedSDVersionError:
        case NoSpaceLeftOnDomain:
        case ImageDoesNotExistInDomainError:
        case NO_IMPLEMENTATION:
        case VOLUME_WAS_NOT_PREPARED_BEFORE_TEARDOWN:
        case IMAGES_NOT_SUPPORTED_ERROR:
        case GET_FILE_LIST_ERROR:
        case STORAGE_DOMAIN_REFRESH_ERROR:
        case VOLUME_GROUP_BLOCK_SIZE_ERROR:
        case MIGRATION_DEST_INVALID_HOSTNAME:
        case ResourceTimeout:
        case HOT_PLUG_UNPLUG_CPU_ERROR:
        case DEVICE_BLOCK_SIZE_NOT_SUPPORTED:
        case V2V_JOB_DOESNT_EXIST:
        case V2V_NO_SUCH_OVF:
        case V2V_JOB_NOT_DONE:
        case V2V_JOB_ALREADY_EXIST:
        case UnsupportedGlusterVolumeReplicaCountError:
        case MissingOvfFileFromVM:
        case ReplicationNotInProgress:
            if (this instanceof IrsBrokerCommand || this instanceof StorageJobVDSCommand) {
                outEx = new IrsOperationFailedNoFailoverException(getReturnStatus().message);
            } else {
                outEx = new VDSErrorException(String.format("Failed in vdscommand to %1$s, error = %2$s", getCommandName(), getReturnStatus().message));
            }
            break;
        case ResourceExhausted:
        case VDS_NETWORK_ERROR:
        case ERR_BAD_ADDR:
            outEx = new VDSNetworkException(getReturnStatus().message);
            break;
        default:
            log.error("Failed in '{}' method", getCommandName());
            outEx = createException();
            break;
    }
    VDSError tempVar = new VDSError();
    tempVar.setCode(returnStatus);
    tempVar.setMessage(getReturnStatus().message);
    outEx.setVdsError(tempVar);
    logToAuditIfNeeded();
    throw outEx;
}
Also used : VDSError(org.ovirt.engine.core.common.errors.VDSError) IRSNonOperationalException(org.ovirt.engine.core.vdsbroker.irsbroker.IRSNonOperationalException) IRSUnicodeArgumentException(org.ovirt.engine.core.vdsbroker.irsbroker.IRSUnicodeArgumentException) EngineError(org.ovirt.engine.core.common.errors.EngineError) IRSNoMasterDomainException(org.ovirt.engine.core.vdsbroker.irsbroker.IRSNoMasterDomainException) IrsOperationFailedNoFailoverException(org.ovirt.engine.core.vdsbroker.irsbroker.IrsOperationFailedNoFailoverException) IrsBrokerCommand(org.ovirt.engine.core.vdsbroker.irsbroker.IrsBrokerCommand)

Example 22 with VDSError

use of org.ovirt.engine.core.common.errors.VDSError in project ovirt-engine by oVirt.

the class CancelMigrateVDSCommand method proceedProxyReturnValue.

/**
 * overrode to improve error handling when cancel migration failed because the VM doesn't exist on the target host.<BR>
 * may happen when migration already ended.
 */
@Override
protected void proceedProxyReturnValue() {
    EngineError returnStatus = getReturnValueFromStatus(getReturnStatus());
    switch(returnStatus) {
        case noVM:
            VDSExceptionBase outEx = createDefaultConcreteException("Cancel migration has failed. Please try again in a few moments and track the VM's event list for details");
            initializeVdsError(returnStatus);
            outEx.setVdsError(new VDSError(EngineError.MIGRATION_CANCEL_ERROR_NO_VM, getReturnStatus().message));
            throw outEx;
        default:
            super.proceedProxyReturnValue();
    }
}
Also used : VDSError(org.ovirt.engine.core.common.errors.VDSError) EngineError(org.ovirt.engine.core.common.errors.EngineError)

Example 23 with VDSError

use of org.ovirt.engine.core.common.errors.VDSError in project ovirt-engine by oVirt.

the class CreateStoragePoolVDSCommand method proceedProxyReturnValue.

@Override
protected void proceedProxyReturnValue() {
    EngineError returnStatus = getReturnValueFromStatus(getReturnStatus());
    switch(returnStatus) {
        // fail the operation without throwing exception
        case StorageDomainAccessError:
            getVDSReturnValue().setSucceeded(false);
            VDSError tempVar = new VDSError();
            tempVar.setCode(EngineError.StorageDomainAccessError);
            tempVar.setMessage(getReturnStatus().message);
            getVDSReturnValue().setVdsError(tempVar);
            break;
        default:
            super.proceedProxyReturnValue();
            initializeVdsError(returnStatus);
            break;
    }
}
Also used : VDSError(org.ovirt.engine.core.common.errors.VDSError) EngineError(org.ovirt.engine.core.common.errors.EngineError)

Example 24 with VDSError

use of org.ovirt.engine.core.common.errors.VDSError in project ovirt-engine by oVirt.

the class GetHostJobsVDSCommand method parseJob.

private HostJobInfo parseJob(Map<String, Object> job) {
    Guid id = Guid.createGuidFromString((String) job.get(VdsProperties.jobId));
    HostJobType type = HostJobType.valueOf((String) job.get(VdsProperties.jobType));
    HostJobStatus status = HostJobStatus.valueOf((String) job.get(VdsProperties.jobStatus));
    String description = (String) job.get(VdsProperties.jobDescription);
    Integer jobProgress = job.containsKey(VdsProperties.jobProgress) ? ((Double) job.get(VdsProperties.jobProgress)).intValue() : null;
    VDSError error = null;
    if (job.containsKey(VdsProperties.jobError)) {
        Map<String, Object> errorInfo = (Map<String, Object>) job.get(VdsProperties.jobError);
        Integer code = (Integer) errorInfo.get(VdsProperties.jobErrorCode);
        String message = (String) errorInfo.get(VdsProperties.jobErrorMessage);
        error = new VDSError(EngineError.forValue(code), message);
    }
    return new HostJobInfo(id, description, type, status, jobProgress, error);
}
Also used : HostJobStatus(org.ovirt.engine.core.common.businessentities.HostJobInfo.HostJobStatus) VDSError(org.ovirt.engine.core.common.errors.VDSError) Guid(org.ovirt.engine.core.compat.Guid) HostJobType(org.ovirt.engine.core.common.businessentities.HostJobInfo.HostJobType) HostJobInfo(org.ovirt.engine.core.common.businessentities.HostJobInfo) Map(java.util.Map)

Aggregations

VDSError (org.ovirt.engine.core.common.errors.VDSError)24 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)13 EngineError (org.ovirt.engine.core.common.errors.EngineError)7 Guid (org.ovirt.engine.core.compat.Guid)3 Map (java.util.Map)2 GlusterVolumeTaskStatusEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity)2 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)1 SocketException (java.net.SocketException)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1 AsyncTaskStatus (org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)1 HostJobInfo (org.ovirt.engine.core.common.businessentities.HostJobInfo)1 HostJobStatus (org.ovirt.engine.core.common.businessentities.HostJobInfo.HostJobStatus)1 HostJobType (org.ovirt.engine.core.common.businessentities.HostJobInfo.HostJobType)1 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)1