Add tar container format
Subsystems (2)
PATCH 1/1 Add tar container format
Tar is a very widely used format to store data in. Sometimes people even put virtual machine images in there.
So it makes sense for qemu to be able to read from tar files. I implemented a written from scratch reader that also knows about the GNU sparse format, which is what pigz creates.
This version checks for filenames that end on well-known extensions. The logic could be changed to search for filenames given on the command line, but that would require changes to more parts of qemu.
The tar reader in conjunctiuon with dzip gives us the chance to download tar'ed up virtual machine images (even via http) and instantly make use of them.
For that we still need to enable the qemu blockery to support stacking though.
--- Makefile | 2 +- block/tar.c | 326 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 327 insertions(+), 1 deletions(-) create mode 100644 block/tar.c
Makefile +1 -1
@@ -73,7 +73,7 @@ block-obj-$(CONFIG_AIO) += posix-aio-compat.o block-nested-y += cow.o qcow.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o block-nested-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o -block-nested-y += parallels.o nbd.o dictzip.o +block-nested-y += parallels.o nbd.o dictzip.o tar.o block-nested-$(CONFIG_WIN32) += raw-win32.o block-nested-$(CONFIG_POSIX) += raw-posix.o block-nested-$(CONFIG_CURL) += curl.o
block/tar.c new file +326 -0
326 lines not on this page · raw message
Signature · 1 line
1.6.0.2
Quoted 4 lines · Alexander Graf
For that we still need to enable the qemu blockery to support stacking though.
Signed-off-by Alexander Graf <[email protected]>
This feels like a bit too much of a one-off to me. I'm concerned that it's something we'd have to support long term that wouldn't have very many users beyond your particular use-case.
So far, we only support image formats that are dedicated to virtual machines. We support http and nbd but those are generic protocols, not necessarily special formats. tar and dzip seem arbitrary. Why not zip, rar, bzip2, or any other format?
You could do all of this by making use of a fuse filesystem.
I'd almost rather see something like gio integration so that this sort of generic filesystem stuff could live somewhere else. I'm curious what others think though. Does it seem reasonable to include this type of functionality?
Quoted 7 lines · Anthony Liguori
Quoted 4 lines · Alexander Graf
For that we still need to enable the qemu blockery to support stacking though.
Signed-off-by Alexander Graf <[email protected]>This feels like a bit too much of a one-off to me. I'm concerned that it's something we'd have to support long term that wouldn't have very many users beyond your particular use-case.
Well, the same goes for "bochs", "parallels", "dmg" and all the other fun image format backends nobody uses, right? How do one or two more hurt you there?
Though I'm not saying that I wouldn't like to see users of this. It's great to have this option for archiving virtual machines (incl. config file) without the need to worry about readability of it. Just tar xzf it and you're done.
Also, we will start using this in SUSE Studio. So all appliances you'll download from there will be in tar.dzip format. That means that if this was in upstream, even fedora or ubuntu users could start those appliances without extracting or even downloading them first.
Quoted 1 line
So far, we only support image formats that are dedicated to virtual machines. We support http and nbd but those are generic protocols, not necessarily special formats. tar and dzip seem arbitrary. Why not zip, rar, bzip2, or any other format?
Simply because this was the only real standard I've found. The dict project uses dictzip for a couple of years now and it seems to be pretty stable (only a single version exists).
Bzip2 is supposed to be chunkable, but I haven't found anyone who did this yet and my knowledge in compression is pretty small. I don't know what rar does, but pkzip has a 2 GB file size limit (which is pretty bad for VM images) and I'm not aware of any seek extensions to it.
If you have good suggestions, please go ahead. We need a VM format container that
a) everyone can extract with existing tools
b) can be used as input for qemu
As a sidenote, the OVF specification states that OVF Packages are supposed to be TAR files.
Quoted 1 line
You could do all of this by making use of a fuse filesystem.
Right, but I really don't want to have a server serving a virtual machine rely on anything even close to fuse. What if the fuse client starts hanging? The whole box goes down? No thanks.
Quoted 1 line
I'd almost rather see something like gio integration so that this sort of generic filesystem stuff could live somewhere else. I'm curious what others think though. Does it seem reasonable to include this type of functionality?
A plugin infrastructure sounds nice at first, but doesn't do all the fedoras and ubuntus out there too much good ;-).
Alex
Quoted 5 lines · Alexander Graf
Quoted 2 lines
I'd almost rather see something like gio integration so that this sort of generic filesystem stuff could live somewhere else. I'm curious what others think though. Does it seem reasonable to include this type of functionality?
A plugin infrastructure sounds nice at first, but doesn't do all the fedoras and ubuntus out there too much good ;-).
If we did plugins, it would not be a GPL-safe boundary so all plugins would be forced to be GPL.
What's attractive about doing plugins for the block layer is that we have a relatively stable interface for block drivers. The current AIO ops should be good for a very long time so API churn shouldn't be a major issue. The code is all pretty well isolated today.
As part of the longer term refactoring, I think it also makes sense to split the block layer into a library that can be consumed independent of QEMU. Obviously, folks want to make use of our block code who don't care at all about QEMU. A lot of people use qemu-img for vmdk manipulation, for instance. It also makes tools like qemu-iotest able to consume the block layer in a saner way.
If others agree, I think we should start going down this road. block-tar/block-dictzip seem like obvious candidates for plugins.
Regards,
Anthony Liguori
Quoted 1 line
Alex
Quoted 1 line · Anthony Liguori
If others agree, I think we should start going down this road. block-tar/block-dictzip seem like obvious candidates for plugins.
And at some point in the distant future, I think it would also make sense for the block layer, once librarized and such, to be split out into a separate sub-project.
Regards,
Anthony Liguori
Quoted 12 lines · Anthony Liguori
What's attractive about doing plugins for the block layer is that we have a relatively stable interface for block drivers. The current AIO ops should be good for a very long time so API churn shouldn't be a major issue. The code is all pretty well isolated today.
As part of the longer term refactoring, I think it also makes sense to split the block layer into a library that can be consumed independent of QEMU. Obviously, folks want to make use of our block code who don't care at all about QEMU. A lot of people use qemu-img for vmdk manipulation, for instance. It also makes tools like qemu-iotest able to consume the block layer in a saner way.
Quoted 2 lines
If others agree, I think we should start going down this road. block-tar/block-dictzip seem like obvious candidates for plugins.
Splitting drivers from the core is a total desaster, you'll end up with the same crap as the X drivers vs core X server versioning mess. After a long stabilization period we might be able to split the block layer _including_ the drivers from qemu if we really want. Splitting the drivers into tiny subpackages would be plain stupid.
As far as additional image formats are concerned I'm personally not a fan at all of any of that image format crap we have right now. Anything like qcow and friends or other formats that do complex metadata manipulation in userspace is a really bad idea for data integrity. Supporting simple containers with static metadata is absolutely fine, even more so it it's read-only like the tar container here.
But one problem with tar is that there are many slightly or even totally different tar formats and extensions around. It's not nessecarily a format I would personally chose for a product. That's something the SuSE stuio people should think about, but nothing that should prevent us from including the format.
Quoted 3 lines
Bzip2 is supposed to be chunkable, but I haven't found anyone who did this yet and my knowledge in compression is pretty small.
Bzip2 proceeds in chunks of approximately 100-900 KB size. However, the size is taken after an initial RLE compression pass. So bzip2 is only chunkable if you remove the initial RLE compression---this means hacking the bzip2 executable (see ADD_CHAR_TO_BLOCK and add_pair_to_block) in bzip2's bzlib.c.
Using GIO may have been a good idea a few years ago, but it seems a bit overengineered given that the block layer of qemu works well and it is pretty complex.
Paolo