Search in sources :

Example 1 with StorageJobCommandParameters

use of org.ovirt.engine.core.common.action.StorageJobCommandParameters in project ovirt-engine by oVirt.

the class SparsifyDiskModel method onSparsify.

public void onSparsify(final ICommandTarget target) {
    List<ActionParametersBase> parameterList = new ArrayList<>();
    for (Disk disk : disksToSparsify) {
        ActionParametersBase parameters = new StorageJobCommandParameters(((DiskImage) disk).getImageId());
        parameterList.add(parameters);
    }
    startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.SparsifyImage, parameterList, result -> {
        stopProgress();
        target.executeCommand(cancelCommand);
    }, this);
}
Also used : StorageJobCommandParameters(org.ovirt.engine.core.common.action.StorageJobCommandParameters) ArrayList(java.util.ArrayList) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 2 with StorageJobCommandParameters

use of org.ovirt.engine.core.common.action.StorageJobCommandParameters in project ovirt-engine by oVirt.

the class BackendDiskResource method sparsify.

@Override
public Response sparsify(Action action) {
    Disk disk = get();
    if (disk == null) {
        throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build());
    }
    Guid imageId = getDiskImageId(disk.getImageId());
    StorageJobCommandParameters params = new StorageJobCommandParameters(imageId);
    return doAction(ActionType.SparsifyImage, params, action);
}
Also used : StorageJobCommandParameters(org.ovirt.engine.core.common.action.StorageJobCommandParameters) WebApplicationException(javax.ws.rs.WebApplicationException) Guid(org.ovirt.engine.core.compat.Guid) Disk(org.ovirt.engine.api.model.Disk)

Aggregations

StorageJobCommandParameters (org.ovirt.engine.core.common.action.StorageJobCommandParameters)2 ArrayList (java.util.ArrayList)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 Disk (org.ovirt.engine.api.model.Disk)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)1 Guid (org.ovirt.engine.core.compat.Guid)1