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;
}
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);
}
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);
}
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());
}
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;
}
Aggregations