vmware / pyvmomi-community-samples

A place for community contributed samples for the pyVmomi library.
Apache License 2.0
1.01k stars 922 forks source link

Allow customizable HTTP block size when reading from remote OVA #692

Open waldner opened 2 years ago

waldner commented 2 years ago
  1. When using a remote OVA source, urlopen's default is to read 8192 bytes at a time, which is very slow (a simple ~1GB OVA might take tens of hours). This proposal uses http.client directly to allow setting the block size (10 MB by default, but depending on the actual environment it can be even higher). In my tests, a 10 MB block size resulted in a 80x reduction of download times from a local LAN web server, and a 100 MB block size produced a 500x reduction. Differences might not be so dramatic depending on the actual conditions, but I think we're still much better off with the new default, and anyway it's tweakable if desired.

  2. As noted in https://github.com/vmware/pyvmomi-community-samples/issues/392, for non-disk objects (like ISO, or NVRAM files) PUT should be used instead of POST. This proposal also applies the change suggested in that issue.