VMware: specify chunk size when reading image data

When reading OVA image data from Glance without specifying chunk size,
nova-compute tries to read the entire tar stream in memory because this
is how the tar fileobject is implemented. This patch fixes this by
specifying the chunk size to be 64KB.

Change-Id: I953dfa1c28c25886306e1c9afe281cf2faca4db5
Closes-Bug: #1495834
This commit is contained in:
Radoslav Gerganov 2015-10-06 16:01:45 +03:00
parent 253cd4bf17
commit 71d2d31b9b
1 changed files with 2 additions and 1 deletions

View File

@ -34,6 +34,7 @@ IMAGE_API = image.API()
IO_THREAD_SLEEP_TIME = .01
GLANCE_POLL_INTERVAL = 5
CHUNK_SIZE = 64 * 1024 # default chunk size for image transfer
class ThreadSafePipe(queue.LightQueue):
@ -173,7 +174,7 @@ class IOThread(object):
self._running = True
while self._running:
try:
data = self.input.read(None)
data = self.input.read(CHUNK_SIZE)
if not data:
self.stop()
self.done.send(True)