Search in sources :

Example 11 with MoveOrCopyImageGroupParameters

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

the class BackendTemplateDiskResource method copy.

@Override
public Response copy(Action action) {
    validateParameters(action, "storageDomain.id|name");
    Guid storageDomainId = getStorageDomainId(action);
    Disk disk = getDisk();
    Guid imageId = asGuid(disk.getImageId());
    MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(imageId, Guid.Empty, storageDomainId, ImageOperation.Copy);
    params.setImageGroupID(asGuid(disk.getId()));
    return doAction(ActionType.MoveOrCopyDisk, params, action);
}
Also used : MoveOrCopyImageGroupParameters(org.ovirt.engine.core.common.action.MoveOrCopyImageGroupParameters) Guid(org.ovirt.engine.core.compat.Guid) Disk(org.ovirt.engine.api.model.Disk)

Example 12 with MoveOrCopyImageGroupParameters

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

the class MoveOrCopyDiskModel method addMoveOrCopyParameters.

protected void addMoveOrCopyParameters(ArrayList<ActionParametersBase> parameters, Guid sourceStorageDomainGuid, Guid destStorageDomainGuid, DiskImage disk) {
    MoveOrCopyImageGroupParameters params = createParameters(sourceStorageDomainGuid, destStorageDomainGuid, disk);
    params.setQuotaId(disk.getQuotaId());
    params.setDiskProfileId(disk.getDiskProfileId());
    params.setNewAlias(disk.getDiskAlias());
    parameters.add(params);
}
Also used : MoveOrCopyImageGroupParameters(org.ovirt.engine.core.common.action.MoveOrCopyImageGroupParameters)

Example 13 with MoveOrCopyImageGroupParameters

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

the class ExportVmCommand method buildMoveOrCopyImageGroupParametersForMemoryDumpImage.

private MoveOrCopyImageGroupParameters buildMoveOrCopyImageGroupParametersForMemoryDumpImage(Guid containerID, DiskImage disk) {
    MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(containerID, disk.getId(), disk.getImageId(), getParameters().getStorageDomainId(), ImageOperation.Copy);
    StorageDomainStatic sourceDomain = storageDomainStaticDao.get(disk.getStorageIds().get(0));
    // so we need to use copy collapse in order to convert it to be sparsed in the export domain
    if (sourceDomain.getStorageType().isBlockDomain()) {
        params.setUseCopyCollapse(true);
        params.setVolumeType(VolumeType.Sparse);
        params.setVolumeFormat(VolumeFormat.RAW);
    }
    return params;
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) MoveOrCopyImageGroupParameters(org.ovirt.engine.core.common.action.MoveOrCopyImageGroupParameters)

Example 14 with MoveOrCopyImageGroupParameters

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

the class ExportVmCommand method buildMoveOrCopyImageGroupParameters.

private MoveOrCopyImageGroupParameters buildMoveOrCopyImageGroupParameters(Guid containerID, DiskImage disk) {
    MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(containerID, disk.getId(), disk.getImageId(), getParameters().getStorageDomainId(), ImageOperation.Copy);
    params.setParentCommand(getActionType());
    params.setEntityInfo(getParameters().getEntityInfo());
    params.setCopyVolumeType(CopyVolumeType.LeafVol);
    params.setForceOverride(getParameters().getForceOverride());
    params.setParentParameters(getParameters());
    params.setSourceDomainId(disk.getStorageIds().get(0));
    return params;
}
Also used : MoveOrCopyImageGroupParameters(org.ovirt.engine.core.common.action.MoveOrCopyImageGroupParameters)

Example 15 with MoveOrCopyImageGroupParameters

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

the class ExportVmCommand method buildMoveOrCopyImageGroupParametersForDisk.

private MoveOrCopyImageGroupParameters buildMoveOrCopyImageGroupParametersForDisk(Guid containerID, DiskImage disk) {
    MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(containerID, disk.getId(), disk.getImageId(), getParameters().getStorageDomainId(), ImageOperation.Copy);
    params.setParentCommand(getActionType());
    params.setEntityInfo(getParameters().getEntityInfo());
    params.setUseCopyCollapse(getParameters().getCopyCollapse());
    DiskImage diskForVolumeInfo = getDiskForVolumeInfo(disk);
    params.setVolumeFormat(diskForVolumeInfo.getVolumeFormat());
    params.setVolumeType(diskForVolumeInfo.getVolumeType());
    params.setCopyVolumeType(CopyVolumeType.LeafVol);
    params.setForceOverride(getParameters().getForceOverride());
    params.setParentParameters(getParameters());
    return params;
}
Also used : MoveOrCopyImageGroupParameters(org.ovirt.engine.core.common.action.MoveOrCopyImageGroupParameters) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Aggregations

MoveOrCopyImageGroupParameters (org.ovirt.engine.core.common.action.MoveOrCopyImageGroupParameters)17 EntityInfo (org.ovirt.engine.core.common.asynctasks.EntityInfo)5 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)4 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)4 Guid (org.ovirt.engine.core.compat.Guid)4 Disk (org.ovirt.engine.api.model.Disk)2 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)2 EngineException (org.ovirt.engine.core.common.errors.EngineException)2 DiskImageBase (org.ovirt.engine.core.common.businessentities.storage.DiskImageBase)1