Search in sources :

Example 1 with TransferDiskImageParameters

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

the class UploadImageModel method createInitParams.

private TransferDiskImageParameters createInitParams() {
    Disk newDisk = diskModel.getDisk();
    AddDiskParameters diskParameters = new AddDiskParameters(newDisk);
    if (diskModel.getDiskStorageType().getEntity() == DiskStorageType.IMAGE || diskModel.getDiskStorageType().getEntity() == DiskStorageType.CINDER) {
        diskParameters.setStorageDomainId(getDiskModel().getStorageDomain().getSelectedItem().getId());
    }
    TransferDiskImageParameters parameters = new TransferDiskImageParameters(diskParameters.getStorageDomainId(), diskParameters);
    parameters.setTransferSize(getImageSize());
    parameters.setVdsId(getDiskModel().getHost().getSelectedItem().getId());
    return parameters;
}
Also used : TransferDiskImageParameters(org.ovirt.engine.core.common.action.TransferDiskImageParameters) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) AddDiskParameters(org.ovirt.engine.core.common.action.AddDiskParameters)

Example 2 with TransferDiskImageParameters

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

the class BackendImageTransfersResource method addForDisk.

@Override
public Response addForDisk(ImageTransfer imageTransfer) {
    TransferDiskImageParameters params = new TransferDiskImageParameters();
    params.setImageGroupID(GuidUtils.asGuid(imageTransfer.getDisk().getId()));
    return performCreate(imageTransfer, params);
}
Also used : TransferDiskImageParameters(org.ovirt.engine.core.common.action.TransferDiskImageParameters)

Example 3 with TransferDiskImageParameters

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

the class BackendImageTransfersResource method addForSnapshot.

@Override
public Response addForSnapshot(ImageTransfer imageTransfer) {
    TransferDiskImageParameters params = new TransferDiskImageParameters();
    params.setImageId(GuidUtils.asGuid(imageTransfer.getSnapshot().getId()));
    return performCreate(imageTransfer, params);
}
Also used : TransferDiskImageParameters(org.ovirt.engine.core.common.action.TransferDiskImageParameters)

Example 4 with TransferDiskImageParameters

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

the class TransferImageCommandTest method testCommandPersistedWithParamUpdates.

@Test
public void testCommandPersistedWithParamUpdates() {
    DiskImage readyImage = initReadyImageForUpload();
    TransferDiskImageParameters params = spy(new TransferDiskImageParameters());
    doReturn(params).when(transferImageCommand).getParameters();
    transferImageCommand.handleImageIsReadyForTransfer();
    // Verify that persistCommand is being called after each of the params changes.
    InOrder inOrder = inOrder(params, transferImageCommand);
    inOrder.verify(params).setStorageDomainId(any());
    inOrder.verify(transferImageCommand).persistCommand(any(), anyBoolean());
    inOrder = inOrder(params, transferImageCommand);
    inOrder.verify(params).setTransferSize(anyLong());
    inOrder.verify(transferImageCommand).persistCommand(any(), anyBoolean());
}
Also used : InOrder(org.mockito.InOrder) TransferDiskImageParameters(org.ovirt.engine.core.common.action.TransferDiskImageParameters) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 5 with TransferDiskImageParameters

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

the class DownloadImageHandler method createInitParams.

private TransferDiskImageParameters createInitParams() {
    TransferDiskImageParameters parameters = new TransferDiskImageParameters();
    parameters.setTransferType(TransferType.Download);
    parameters.setImageGroupID(diskImage.getId());
    String fileExtension = diskImage.getVolumeFormat() == VolumeFormat.COW ? ".qcow2" : // $NON-NLS-1$ //$NON-NLS-2$
    ".raw";
    // $NON-NLS-1$
    parameters.setDownloadFilename(diskImage.getDiskAlias() + fileExtension);
    parameters.setTransferSize(diskImage.getActualSizeInBytes());
    return parameters;
}
Also used : TransferDiskImageParameters(org.ovirt.engine.core.common.action.TransferDiskImageParameters)

Aggregations

TransferDiskImageParameters (org.ovirt.engine.core.common.action.TransferDiskImageParameters)6 Test (org.junit.Test)1 InOrder (org.mockito.InOrder)1 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)1 AddDiskParameters (org.ovirt.engine.core.common.action.AddDiskParameters)1 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)1 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)1