Search in sources :

Example 1 with DestroyImageVDSCommandParameters

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

the class DestroyImageVDSCommand method executeIrsBrokerCommand.

@Override
protected void executeIrsBrokerCommand() {
    DestroyImageVDSCommandParameters params = getParameters();
    int imageListSize = params.getImageList().size();
    String[] volUUID = new String[imageListSize];
    int i = 0;
    for (Guid tempGuid : params.getImageList()) {
        volUUID[i++] = tempGuid.toString();
    }
    uuidReturn = deleteVolume(params.getStorageDomainId().toString(), params.getStoragePoolId().toString(), params.getImageGroupId().toString(), volUUID, String.valueOf(params.getPostZero()), params.isDiscard(), String.valueOf(params.getForce()));
    proceedProxyReturnValue();
    Guid taskID = new Guid(uuidReturn.uuid);
    getVDSReturnValue().setCreationInfo(new AsyncTaskCreationInfo(taskID, AsyncTaskType.deleteVolume, getParameters().getStoragePoolId()));
}
Also used : DestroyImageVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.DestroyImageVDSCommandParameters) AsyncTaskCreationInfo(org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo) Guid(org.ovirt.engine.core.compat.Guid)

Example 2 with DestroyImageVDSCommandParameters

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

the class RestoreFromSnapshotCommand method performImageVdsmOperation.

@Override
protected boolean performImageVdsmOperation() {
    VDSReturnValue vdsReturnValue = null;
    try {
        Guid storagePoolId = getDiskImage().getStoragePoolId() != null ? getDiskImage().getStoragePoolId() : Guid.Empty;
        Guid storageDomainId = getDiskImage().getStorageIds() != null && !getDiskImage().getStorageIds().isEmpty() ? getDiskImage().getStorageIds().get(0) : Guid.Empty;
        Guid imageGroupId = getDiskImage().getId() != null ? getDiskImage().getId() : Guid.Empty;
        Guid taskId = persistAsyncTaskPlaceHolder(ActionType.RestoreAllSnapshots);
        vdsReturnValue = runVdsCommand(VDSCommandType.DestroyImage, postDeleteActionHandler.fixParameters(new DestroyImageVDSCommandParameters(storagePoolId, storageDomainId, imageGroupId, _imagesToDelete, getDiskImage().isWipeAfterDelete(), storageDomainDao.get(storageDomainId).getDiscardAfterDelete(), true)));
        if (vdsReturnValue.getSucceeded()) {
            getReturnValue().getInternalVdsmTaskIdList().add(createTask(taskId, vdsReturnValue.getCreationInfo(), ActionType.RestoreAllSnapshots, VdcObjectType.Storage, storageDomainId));
        }
    }// Don't throw an exception when cannot destroy image in the VDSM.
     catch (EngineException e) {
        // Set fault for parent command RestoreAllSnapshotCommand to use, if decided to fail the command.
        getReturnValue().setFault(new EngineFault(e, e.getVdsError().getCode()));
        log.info("Image '{}' not exist in Irs", getDiskImage().getImageId());
    }
    return vdsReturnValue != null ? vdsReturnValue.getSucceeded() : false;
}
Also used : DestroyImageVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.DestroyImageVDSCommandParameters) EngineFault(org.ovirt.engine.core.common.errors.EngineFault) EngineException(org.ovirt.engine.core.common.errors.EngineException) Guid(org.ovirt.engine.core.compat.Guid) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Aggregations

DestroyImageVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.DestroyImageVDSCommandParameters)2 Guid (org.ovirt.engine.core.compat.Guid)2 AsyncTaskCreationInfo (org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo)1 EngineException (org.ovirt.engine.core.common.errors.EngineException)1 EngineFault (org.ovirt.engine.core.common.errors.EngineFault)1 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)1