use of org.ovirt.engine.core.common.action.MoveOrCopyImageGroupParameters in project ovirt-engine by oVirt.
the class ImportVmCommand method buildMoveOrCopyImageGroupParametersForMemoryConfImage.
private MoveOrCopyImageGroupParameters buildMoveOrCopyImageGroupParametersForMemoryConfImage(Guid containerID, Guid storageId, Guid imageId, Guid volumeId) {
MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(containerID, imageId, volumeId, imageId, volumeId, storageId, ImageOperation.Copy);
params.setParentCommand(getActionType());
// This volume is always of type 'sparse' and format 'cow' so no need to convert,
// and there're no snapshots for it so no reason to use copy collapse
params.setUseCopyCollapse(false);
params.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVm().getId()));
params.setCopyVolumeType(CopyVolumeType.LeafVol);
params.setForceOverride(getParameters().getForceOverride());
params.setParentParameters(getParameters());
params.setSourceDomainId(getParameters().getSourceDomainId());
params.setStoragePoolId(getParameters().getStoragePoolId());
params.setImportEntity(true);
return params;
}
use of org.ovirt.engine.core.common.action.MoveOrCopyImageGroupParameters in project ovirt-engine by oVirt.
the class BackendDiskResource method copy.
@Override
public Response copy(Action action) {
validateParameters(action, "storageDomain.id|name");
Guid storageDomainId = getStorageDomainId(action);
Disk disk = get();
Guid imageId = getDiskImageId(disk.getImageId());
Guid sourceStorageDomainId = getSourceStorageDomainId(disk);
MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(imageId, sourceStorageDomainId, storageDomainId, ImageOperation.Copy);
params.setImageGroupID(asGuid(disk.getId()));
params.setQuotaId(action.isSetQuota() ? asGuid(action.getQuota().getId()) : null);
params.setDiskProfileId(action.isSetDiskProfile() ? asGuid(action.getDiskProfile().getId()) : null);
Disk actionDisk = action.getDisk();
if (actionDisk != null) {
String name = actionDisk.getName();
String alias = actionDisk.getAlias();
if (name != null && !StringUtils.isEmpty(name)) {
params.setNewAlias(name);
} else if (alias != null && !StringUtils.isEmpty(alias)) {
params.setNewAlias(alias);
}
}
return doAction(ActionType.MoveOrCopyDisk, params, action);
}
Aggregations