I'll also include some comments I provided a fellow employee on the topic (Note in my
case I am using PowerShell and JSON so the formatting is going to be a bit different, but
you'll get the idea)
This is a description of how I handle the uploads (I used a little code samples, hopefully
the variable names make sense):
Create $ImageTransferSession
Wait til $ImageTransferSession.phase -eq "transferring"
Create a filestream to read the source file in chunks
I used $DefaultBlockSize = 64MB
Loop through each chunk of the source file until done
In Powershell (like curl) I sent each chunk individually
$Headers = @{"Accept" = "application/json";"ContentType" =
"application/octet-stream";"Content-Range" = "bytes
$($numBytesRead - $ReadBlock)-$($numBytesRead)/*";"Authorization" =
"Bearer $($access_token)";
"All-Content"="true";"Content-Length" =
"$($ReadBlock)"}
$Body = [System.IO.MemoryStream]::new($Buffer, 0, $ReadBlock)
Invoke-RestMethod -Uri "$($ImageTransferSession.proxy_url)?flush=y" -Headers
$Headers -Body $Body -Method PUT -ContentType "application/octet-stream" -EV
WebError
After each I checked the Image Transfer Status
When all the chunks are sent close the file stream and check the image transfer status
SIZE to match the source file size
Finalize the Image Transfer Status if sizes match, cancel if not
ALSO NOTE: I used "proxy_url" NOT "transfer_url", so the traffic
passes THROUGH OLVM, instead of trying to connect directly to the KVM hosts, which
requires additional authentication handling
The web response error also gets written into the /var/log/ovirt-engine/engine.log