mirror of
https://github.com/proxmoxer/proxmoxer.git
synced 2026-04-25 15:16:01 +03:00
[GH-ISSUE #67] Uploading large files causes OverflowError #35
Labels
No labels
backend:https
backend:local
backend:openssh
backend:ssh_paramiko
pull-request
status:ansible-issue
status:help-wanted
status:info-needed
status:proxmox-issue
status:review-needed
type:bug 🐞
type:dependency ⛓️
type:docs 📝
type:enhancement ⏫
type:maintenance 🛠️
type:meta
type:question ❓
type:request ✋
type:testing 🧪
version:1.x
version:latest
version:py2
version:py3
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/proxmoxer#35
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @aelth on GitHub (Sep 28, 2021).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/67
Originally assigned to: @jhollowe on GitHub.
Hello,
I was trying to upload an ISO file (large one, larger than 5 GBs) and following the example from the documentation, I got an error:
By following the stack trace, I realized that the wrong argument type is being used in the
create/POSTcall.When
filenameargument is being used, proxmoxer https backend transforms it into afilesparameter for requests (basically, a dictionary):Since the requests' module parameter should be
fileand notfilename, the following call succeeds:I suggest you test this and update the documentation if this is really the case in general, or I'm having some weird quirks:)
Also,
download-urlmethod does not work, it simply isn't parsed properly and it's dynamic generation fails.@aelth commented on GitHub (Sep 28, 2021):
A small update - I was wrong about the
fileargument, it doesn't work at all withfileand withfilename, it fails for large files.If I leave
fileargument, there is no overflow error shown (from the requests part), but although the file is seemingly being uploaded correctly, it fails because the proxmox API handler expectsfilenameargument:@jhollowe commented on GitHub (Sep 30, 2021):
This is just a limitation of requests. I'm looking into trying to use requests_toolbox's MultipartEncoder to upload larger files. I'll update this thread with progress
@jhollowe commented on GitHub (Sep 30, 2021):
@aelth what versions are you using (python, PVE, and proxmoxer)?
@jhollowe commented on GitHub (Sep 30, 2021):
It appears that requests already will multipart encode the data, so requests_toolbox's MultipartEncoder is redundant.
The issue is that the call to requests is not streaming the file but is attempting to send the entire file in a single send which causes issues in the SSL layer due to a 32bit signed int size limit (the 2147483647 bytes).
The SSL error will hopefully be fixed soon, but this is really just an indication of requests (or at least how we are using requests) trying to read everything into memory and then sending. I'll keep working on it. In the meantime, you can use the download-url endpoint to pull the ISO from an external source.
References:
Issue for SSL
Issue for requests
@jhollowe commented on GitHub (Sep 30, 2021):
look at #61 for how to deal with paths that contain hyphens.
@aelth commented on GitHub (Oct 2, 2021):
My environment is the following:
Thanks for the help regarding the
download-urlmethod - the proposed alternative works, but the problem with this call is that it's asynchronous and I need to poll/check whether the ISO has been uploaded successfully and it adds additional complexity if the file being uploaded is local (I have to create a simple web server).I'm still experimenting with
download-url.Thanks!
@jhollowe commented on GitHub (Oct 2, 2021):
@aelth if you are able, check the PR #68 and see if that resolves the issue for you. You will need to
pip install requests_toolbeltif you don't already have it. I'd like someone else to test it before I merge it.@aelth commented on GitHub (Oct 4, 2021):
@jhollowe I can confirm that this PR indeed solves the issue for me!
Large ISO files (> 2 GB), as well as small ISOs are uploaded successfully using
uploadcall andfilenameparameter.Thank you very much for your assistance.
P.S. You can close the ticket, but I would like to use this opportunity to ask whether you have some ideas regarding the
download-urlcall. It works, but the HTTP call returns immediately with the task ID.If I want to serve local ISOs, is my best option to use a simple HTTP server and poll the returned task ID status from Proxmox VE until the task is finished?
Thanks,
aelth
@jhollowe commented on GitHub (Oct 5, 2021):
yeah, you can use the task ID to poll for the task status from the nodes/{node}/tasks/{upid}/status endpoint. you could theoretically pull the log from the task, parse it, and weight your polling frequency based on how close to being done it is, but that would be (imho) more effort than it is worth. Now that the upload works, the only benefit I can see from
download-urlis the hash check, but if you are pulling from your local machine, you should trust the source (your machine) is providing the expected file.So if the upload doesn't work, you could do the following steps:
http.serverto serve the ISO/template you want to transferdownload-urlAPI call to download the file from your machinedownload-urltask is complete@jhollowe commented on GitHub (Oct 5, 2021):
I'm thinking it might be cool to add a new class that is a helper class for common tasks. So ideally you could pass it a task ID and it would block until it was complete and return the result and something similar for other qemu's exec.
@aelth commented on GitHub (Oct 6, 2021):
Yes, that sounds great!
I used a simple polling loop, but it would be great if proxmoxer had a helper class for such common tasks.
Thanks again for helping and solving the issue quickly!
Best regards,
aelth