[openstack-dev] Create a tar.gz stream from a block device
mate.lakat at citrix.com
Wed Aug 14 15:58:33 UTC 2013
I would like to create a readable tar.gz stream, inside that stream I
want to see only one file, and that file's content should be read from a
The virtual disk is attached to domU as a block device (/dev/xvdb)
I would like to produce a tar.gz, that contains the contents of
/dev/xvdb, file name inside the tar.gz does not matter.
Here is my current solution:
The main problem is, that tarfile does not support adding content
incrementaly, it only has a addfile method:
tfile = tarfile.open(fileobj=output, mode='w|gz')
And for the glance client, I need to provide a readable file-like:
image_service.update(self.context, image_id, metadata,
The change is solving the issue by creating a separate process to create
the targz stream, and give that process' output stream to glance.
Any other ideas?
More information about the OpenStack-dev