def get_image_data(self):
"""This function will:
1). export VDI as VHD stream;
2). make gzipped tarball from the VHD stream;
3). read from the tarball stream.and return the iterable data.
"""
tarpipe_out, tarpipe_in = utils.create_pipe()
pool = eventlet.GreenPool()
pool.spawn(self.start_image_stream_generator, tarpipe_in)
try:
while True:
data = tarpipe_out.read(CHUNK_SIZE)
if not data:
break
yield data
except Exception:
LOG.debug("Failed to read chunks from the tarfile "
"stream.")
raise
finally:
tarpipe_out.close()
pool.waitall()
评论列表
文章目录