storing machine data in qcow images?
Quoted 1 line · Michael S. Tsirkin
On Wed, Jun 06, 2018 at 07:06:27PM +0200, Max Reitz wrote:
[...]
Quoted 4 lines
Quoted 2 lines
Er, yeah, OK. But it was my understanding that we decided that we have a management layer on top of qemu to make things simple.
Who's we?
Everyone I'm usually talking to when it comes to adding features to the block layer, be it on the mailing list or at KVM Forum.
Also my own judgment, when I look at how extensively the block layer uses QMP, which by definition is not meant to be used by humans.
So this is strongly biased by my immediate environment.
Quoted 3 lines
I don't think the QEMU community completely gave up on people
using QEMU directly. It will need to be much more user-friendly than it is right now.
You are the very first person I hear this from. Don't take this as disagreement, it's just that most of the energy recently seem to go into making qemu interoperate more easily with management layers than with end users. Those goals are not necessarily mutually exclusive, but one thing this changes did was to make "modern" qemu configuration rather verbose, which is not what I'd call user-friendly.
Quoted 2 lines
But it's possible. Fabrice built an emulator in
javascript, you go to a URL bam it runs a VM.
So?
You can still give qemu an image directly and bam it runs a VM. It's just that you get an i440 with an IDE HDD, probably like the JS qemu.
The whole point of this thread was that you might want to run q35, and I don't know, maybe virtio-blk/scsi. So exactly what you don't get from the JS VM.
qemu would be very easy to use if it didn't offer any configuration options. The problem is that is offers a huge load of configuration options and it is not reasonable to expect every user to know all of them.
One way to solve this is to add a management layer which knows all of the options and may choose good defaults based on knowledge that the qemu process itself doesn't have (i.e. "put implementation in qemu, and choose the policy in the management layer"). This is at least what the block layer usually chooses to do.
Quoted 3 lines
Quoted 1 line
Also, this is once more a case of first deciding what we want at all.
Who's we here again?
The participants of this discussion. Maybe I should have said "you" because it doesn't necessarily concern myself.
OTOH, we don't have an appliance solution so far (as far as I'm aware), so I suppose it concerns all of the qemu community, and probably everyone working somewhere up any qemu management stack as well.
Quoted 4 lines
Different people want different things. Enough
people seem to want to store tagged data with a disk image that it might be worth someone's while to try to add that capability for starters to qemu-img.
I disagree, and I will explain why below. [1]
Quoted 6 lines
Quoted 3 lines
Dave wants configuration options for the upper management layer which are completely opaque to qemu. That has nothing to do whatsoever with the usability of qemu itself.
That's why I keep saying, let's start with implementing a mechanism, worry about policy later if at all.
[1] I wholeheartedly disagree.
Say you have this mechanism now. Whatever mechanism it is, because there isn't even any consensus on that (you'd like key-value binary object storage, Dave just wants a simple strong with some key-value format that hasn't been defined in detail, although he has given some proposals).
Then you need to implement something on top of it, store some values, interpret them somehow. And this is exactly what I am asking right now.
What do you want to store? Where do you want to interpret it?
I do not understand why you think it's harder to decide that now than after you have extended qcow2.
I absolutely do think designing the qcow2 extension at least becomes simpler if you do that design now.
There is a case to be made that one shouldn't worry too much about the future. Sometimes you just gotta start somewhere and see where it leads, maybe the initial design was crap, too bad, then you need to start over. But at least you got something done.
But we have talked for half a week now. In my very personal opinion we definitely haven't reached the point yet where we just need to start with something. Appliances would be a big thing, no need to rush it.
[...]
Quoted 3 lines
I think what we are seeing here is many people jumping on the bandwagon and finding more and more uses for ability to store meta-data in the qcow2 file.
I don't see that here, but it may very well be true that other people may find it useful even for other purposes than appliances.
Quoted 3 lines
This just means we should make it flexible enough to possibly support more uses. It does not mean we need to make it read mail on day 1.
So you are saying that we may end up with multiple parties storing (meta-)data independently in the qcow2 file?
That would be an argument on why we'd want opaque metadata storage before there are concrete design documents, and on why it doesn't matter that you focus on qemu whereas others focus on the management layer.
Though it would mean opaque storage, as I've said, and that storing data in the qcow2 file still probably does not make sense for some of the possible use cases. For instance, you propose storing data for qemu proper without any management layer, but this poses the question again of who should interpret that data. (A management layer may just query the image before launching qemu and then set the appropriate options, but it gets difficult for the block layer to open the qcow2 image and change the machine type when qemu is already running. Though maybe you could at least error out when incompatible options have been used to launch qemu. Hm. Another question was who'd be supposed to store the data.)
[...]
Quoted 6 lines
Quoted 3 lines
And if you make the format decidedly qcow2-independent, the whole "putting it into qcow2 is the simplest implementation" argument becomes rather weak.
I don't see why. Yes I think it's a separate format that we should just allow storing in qcow2 for usability.
It becomes weak because storing it in qcow2 would no longer be the simplest implementation if you'd need to be able to read it from a file outside of a qcow2 image anyway.
It still may be the easiest use case for users.
[...]
Quoted 7 lines
Quoted 4 lines
But all of that writing once again comes down to this: You are talking about qemu. Dave is talking about something higher in the management layer. Those are different things, and as I said, we first need to find common ground there.
The common ground is that both me and Dave find it useful to store meta-data in the disk image.
Though it seems to me that you have very different ideas on how to store it. As far as I have understood, Dave just wants to store a bit of data that might even go into the image header, whereas you'd prefer a full-blown infrastructure for binary storage and large objects, because someone might want that at some point.
That isn't to say I personally prefer either, it just means that those are different and deciding on one naturally changes what to do.
There may be even other approaches, I don't know.
And my idea was that we should evaluate the different use cases for storing arbitrary metadata in a qcow2 file, and then we'd see whether it does or doesn't make sense to do so, for each case.
I think making qemu store something in the qcow2 file doesn't bring too much because first, qemu couldn't really interpret that information by itself (it could at best detect conflicting configuration, though in my head checking qemu configuration in the qcow2 driver screams complexity; and storing that information automatically would be problematic); and secondly, I don't think that we can solve the complexity that is modern qemu configuration by just putting it into a qcow2 file. That will only work as long as the user doesn't want to change anything. There is probably much more to say, but all of that would deserve its own thread.
Regarding designing an appliance format, there has already been some discussion, so I won't say anything about that now, except that it too should go into its own thread so that people are aware and don't think it's just a qcow2 issue.
Quoted 6 lines
Quoted 6 lines
This is exactly why I said "where to store it heavily depends on what we want to store and how we want to use it." As long as we don't know that, all of us are using strawman arguments where some other party suddenly chimes in and says "no, no, no, this is not what I'm talking about". Yes, maybe you aren't, but someone else is.
Quoted 7 lines
Quoted 1 line
[...]
Looks like discussion has run its course.
I think it's time for someone motivated enough to send a patch. If enough interested people ack it, we will know it addresses some of their needs.
OK, but don't expect me to merge it at the current state of this discussion[2]. If you or someone else sends a patch, I may raise my concerns (though I will probably not NACK it) and I will defer the decision to Kevin.
[2] By that I mean that I will not merge a feature-adding patch with a justification of "We'll find a use for it later", which is exactly what you've said in this mail. (Though Dave does have concrete intentions, so if he can expand on that, give an ACK and explain why this is worth the effort (and the effort depends on the implementation complexity), then things will probably be different.)
[...]
Quoted 4 lines
Quoted 2 lines
So you want appliances, do I understand that correctly? Because that is exactly what Dave doesn't want.
That's policy. I see no need to prevent people from building appliances,
Dave does. He explicitly raised the idea of limiting the things that can be stored in a qcow2 file, precisely because he didn't want the feature to become too complex.
Quoted 2 lines
though right now I'm not interested in building them myself. We there's a mechanism both kinds of people can use, then great.
Such a flexible feature means complexity, and in my opinion a complex feature needs a reasonable justification. "People will find a use for it" is not reasonable.
Although it really is not unlikely that I'm wrong and that a flexible metadata storage does not need to be complex.
[...]
Quoted 18 lines
Quoted 11 lines
Quoted 1 line
Software developers are being paid for saving people's time.
Very good point, but I did say something like this before: I do not oppose appliances whatsoever. In fact, it seems like a nice thing to have.
But, here's the deal: I do not think putting that data into qcow2 to be the best solution. Furthermore, I have things to do that I consider more important than developing an appliance solution. Therefore, it's not like I'm sitting around doing nothing when I could be developing a solution to this issue here.
Quoted 6 lines
I kept saying that I consider all of this an inconvenience. Yes, it would be nice to have. But I have things on my to do list that are hard feature requests, things that people really do need. We all have. We all need to decide how we can use our own time as efficiently as possible. And I do not think that developing an appliance solution would be the best use of my time. (Until my manager disagrees.)
Quoted 2 lines
As long as you don't start sending nacks on the basis that it's also not the best use of other's time, I don't mind.
No, but I'm one of the qcow2 maintainers, so any feature added to qcow2 just is a burden to myself and may therefore cost me time.
Luckily there is another qcow2 maintainer, so I will not NACK features based on the fact that they are just a burden. If Kevin wants to merge a feature that I don't deem sufficiently useful, then he can go right ahead.
[...]
Quoted 10 lines
Quoted 9 lines
And as I've said multiple times now, but I can't repeat myself often enough, I think it would be most efficient if we worried about what we want to store first, before we worry about where to store it. I believe that once we have a hard requirement on what we want to store and how to use it (that most people agree on), we will have a set of constraints on how we can represent that data and where it needs to be stored, and this will give us a simple yes or no to the question whether the data needs to be stored in qcow2, or whether there is any better way (or whether it can be stored in qcow2, but need not be).
Quoted 2 lines
Well the subject says it, does it not? We want to store machine data there.
Are you sure?
Firstly, that is not sufficiently precise. Do you want an appliance, i.e. store everything? Do you want to store just something and limit everyone in what can be stored (Dave's proposal)? That is a difference, and that is exactly what I was asking.
Secondly, in this mail you even seemed to propose storing just any metadata that might be related to a VM (or maybe not even that). This too has some (meta-?)influence on the design.
For instance, if you want to store only VM-related information, we can document those structures in the qcow2 specification in the qemu tree (or at least link to another document in the qemu tree). But if you want to be able to store any metadata that just anyone wants to store, then that won't be possible. (And this would have implications. For instance, someone might decide on storing metadata that makes the qcow2 image effectively unreadable (e.g. by storing a special backing link). I wouldn't like that, but we couldn't do anything about it if we'd allow storage of arbitrary metadata.)
[...]
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
Old QEMU can't handle tar files. You need to unpack them, then figure out that there are two files in the tar, one is just for new qemu versions, one is portable. At which point you need to go figure out what is your QEMU version.
And old qemu versions will just give you a blank screen for a qcow2 file with required non-default options.
Compatiblity is not worthless simply because we do not have time travel.
Dave was saying that the worst thing about the whole q35 thing is that users download an image and have no idea why it isn't working. Figuring that out may take a long time, because nothing is even throwing an error message.
If we had a new format, users couldn't even run it in qemu, so they would quickly figure out that in order to run this VM, they need to update their stack.
If we just add this information to qcow2, those users with outdated qemu versions would again have to figure out why the image isn't working.
Sure, that is a minor issue that would solve itself by users slowly upgrading their qemu, but it goes to show that compatibility may not always be what is best.
Max
Quoted 3 lines · Max Reitz
qemu would be very easy to use if it didn't offer any configuration options. The problem is that is offers a huge load of configuration options and it is not reasonable to expect every user to know all of them.
Right but once one user id find a way to make a specific guest work in a specific VM, it should not be as hard as it is to replicate the success.
...
Quoted 6 lines
Quoted 3 lines
This just means we should make it flexible enough to possibly support more uses. It does not mean we need to make it read mail on day 1.
So you are saying that we may end up with multiple parties storing (meta-)data independently in the qcow2 file?
Absolutely.
Quoted 2 lines
before there are concrete design documents, and on why it doesn't matter that you focus on qemu whereas others focus on the management layer.
Right. That's what I'm saying.
Quoted 43 lines
Though it would mean opaque storage, as I've said, and that storing data in the qcow2 file still probably does not make sense for some of the possible use cases. For instance, you propose storing data for qemu proper without any management layer, but this poses the question again of who should interpret that data. (A management layer may just query the image before launching qemu and then set the appropriate options, but it gets difficult for the block layer to open the qcow2 image and change the machine type when qemu is already running. Though maybe you could at least error out when incompatible options have been used to launch qemu. Hm. Another question was who'd be supposed to store the data.)
[...]
Quoted 6 lines
Quoted 3 lines
And if you make the format decidedly qcow2-independent, the whole "putting it into qcow2 is the simplest implementation" argument becomes rather weak.
I don't see why. Yes I think it's a separate format that we should just allow storing in qcow2 for usability.
It becomes weak because storing it in qcow2 would no longer be the simplest implementation if you'd need to be able to read it from a file outside of a qcow2 image anyway.
It still may be the easiest use case for users.
[...]
Quoted 7 lines
Quoted 4 lines
But all of that writing once again comes down to this: You are talking about qemu. Dave is talking about something higher in the management layer. Those are different things, and as I said, we first need to find common ground there.
The common ground is that both me and Dave find it useful to store meta-data in the disk image.
Though it seems to me that you have very different ideas on how to store it. As far as I have understood, Dave just wants to store a bit of data that might even go into the image header, whereas you'd prefer a full-blown infrastructure for binary storage and large objects, because someone might want that at some point.
Quoted 4 lines
That isn't to say I personally prefer either, it just means that those are different and deciding on one naturally changes what to do.
There may be even other approaches, I don't know.
I thought I heard Dave utter "key-value store" at some point, which likely precludes "go directly into the header".
Quoted 3 lines
And my idea was that we should evaluate the different use cases for storing arbitrary metadata in a qcow2 file, and then we'd see whether it does or doesn't make sense to do so, for each case.
As block guys maybe you could ask more specific questions then. E.g. "would 1/2K of data be sufficient for these purposes"? That's a more valid point than a generic "tells us what it's for" question.
Quoted 9 lines
I think making qemu store something in the qcow2 file doesn't bring too much because first, qemu couldn't really interpret that information by itself (it could at best detect conflicting configuration, though in my head checking qemu configuration in the qcow2 driver screams complexity; and storing that information automatically would be problematic); and secondly, I don't think that we can solve the complexity that is modern qemu configuration by just putting it into a qcow2 file. That will only work as long as the user doesn't want to change anything. There is probably much more to say, but all of that would deserve its own thread.
But I do think we can solve only doing it once and not per user of an image.
Quoted 24 lines
Regarding designing an appliance format, there has already been some discussion, so I won't say anything about that now, except that it too should go into its own thread so that people are aware and don't think it's just a qcow2 issue.
Quoted 6 lines
Quoted 6 lines
This is exactly why I said "where to store it heavily depends on what we want to store and how we want to use it." As long as we don't know that, all of us are using strawman arguments where some other party suddenly chimes in and says "no, no, no, this is not what I'm talking about". Yes, maybe you aren't, but someone else is.
Quoted 7 lines
Quoted 1 line
[...]
Looks like discussion has run its course.
I think it's time for someone motivated enough to send a patch. If enough interested people ack it, we will know it addresses some of their needs.
OK, but don't expect me to merge it at the current state of this discussion[2]. If you or someone else sends a patch, I may raise my concerns (though I will probably not NACK it) and I will defer the decision to Kevin.
Quoted 8 lines
[2] By that I mean that I will not merge a feature-adding patch with a justification of "We'll find a use for it later", which is exactly what you've said in this mail. (Though Dave does have concrete intentions, so if he can expand on that, give an ACK and explain why this is worth the effort (and the effort depends on the implementation complexity), then things will probably be different.)
[...]
I'd expect a first patch to have ability to store and retrieve the machine type used. Hopefully for qemu to check and warn if it does not match the specified one, and probably using as default if nothing was specified.
Quoted 12 lines
Quoted 4 lines
Quoted 2 lines
So you want appliances, do I understand that correctly? Because that is exactly what Dave doesn't want.
That's policy. I see no need to prevent people from building appliances,
Dave does. He explicitly raised the idea of limiting the things that can be stored in a qcow2 file, precisely because he didn't want the feature to become too complex.
Quoted 2 lines
though right now I'm not interested in building them myself. We there's a mechanism both kinds of people can use, then great.
Quoted 8 lines
Such a flexible feature means complexity, and in my opinion a complex feature needs a reasonable justification. "People will find a use for it" is not reasonable.
Although it really is not unlikely that I'm wrong and that a flexible metadata storage does not need to be complex.
[...]
I'm not saying people will find a use for it. I think we already have one use for it and if it's generic enough more people will find more uses for it.
Quoted 63 lines
Quoted 18 lines
Quoted 11 lines
Quoted 1 line
Software developers are being paid for saving people's time.
Very good point, but I did say something like this before: I do not oppose appliances whatsoever. In fact, it seems like a nice thing to have.
But, here's the deal: I do not think putting that data into qcow2 to be the best solution. Furthermore, I have things to do that I consider more important than developing an appliance solution. Therefore, it's not like I'm sitting around doing nothing when I could be developing a solution to this issue here.
Quoted 6 lines
I kept saying that I consider all of this an inconvenience. Yes, it would be nice to have. But I have things on my to do list that are hard feature requests, things that people really do need. We all have. We all need to decide how we can use our own time as efficiently as possible. And I do not think that developing an appliance solution would be the best use of my time. (Until my manager disagrees.)
Quoted 2 lines
As long as you don't start sending nacks on the basis that it's also not the best use of other's time, I don't mind.
No, but I'm one of the qcow2 maintainers, so any feature added to qcow2 just is a burden to myself and may therefore cost me time.
Luckily there is another qcow2 maintainer, so I will not NACK features based on the fact that they are just a burden. If Kevin wants to merge a feature that I don't deem sufficiently useful, then he can go right ahead.
[...]
Quoted 10 lines
Quoted 9 lines
And as I've said multiple times now, but I can't repeat myself often enough, I think it would be most efficient if we worried about what we want to store first, before we worry about where to store it. I believe that once we have a hard requirement on what we want to store and how to use it (that most people agree on), we will have a set of constraints on how we can represent that data and where it needs to be stored, and this will give us a simple yes or no to the question whether the data needs to be stored in qcow2, or whether there is any better way (or whether it can be stored in qcow2, but need not be).
Quoted 2 lines
Well the subject says it, does it not? We want to store machine data there.
Are you sure?
Firstly, that is not sufficiently precise. Do you want an appliance, i.e. store everything? Do you want to store just something and limit everyone in what can be stored (Dave's proposal)? That is a difference, and that is exactly what I was asking.
Secondly, in this mail you even seemed to propose storing just any metadata that might be related to a VM (or maybe not even that). This too has some (meta-?)influence on the design.
For instance, if you want to store only VM-related information, we can document those structures in the qcow2 specification in the qemu tree (or at least link to another document in the qemu tree). But if you want to be able to store any metadata that just anyone wants to store, then that won't be possible. (And this would have implications. For instance, someone might decide on storing metadata that makes the qcow2 image effectively unreadable (e.g. by storing a special backing link). I wouldn't like that, but we couldn't do anything about it if we'd allow storage of arbitrary metadata.)
Quoted 1 line
[...]
And what if I say "whatever"? Yes I see a very specific usecase which will be well served by adding a specific bit of data in the disk image. Others see other uses.
Quoted 10 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
Old QEMU can't handle tar files. You need to unpack them, then figure out that there are two files in the tar, one is just for new qemu versions, one is portable. At which point you need to go figure out what is your QEMU version.
And old qemu versions will just give you a blank screen for a qcow2 file with required non-default options.
Compatiblity is not worthless simply because we do not have time travel.
Quoted 8 lines
Dave was saying that the worst thing about the whole q35 thing is that users download an image and have no idea why it isn't working. Figuring that out may take a long time, because nothing is even throwing an error message.
If we had a new format, users couldn't even run it in qemu, so they would quickly figure out that in order to run this VM, they need to update their stack.
Since then users of old software can't use your image at all, then most people simply will not create the new fangled image format.
Quoted 2 lines
If we just add this information to qcow2, those users with outdated qemu versions would again have to figure out why the image isn't working.
By that metric compatibility is never worth it unless you have ability to add new functionality retroactively to existing software.
Quoted 7 lines
Sure, that is a minor issue that would solve itself by users slowly upgrading their qemu, but it goes to show that compatibility may not always be what is best.
Max
Certainly in this case the feature is minor, so it's extremely important.
Signature · 1 line
MST
Quoted 1 line · On Mon, 11 Jun 2018 05:06:53 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
On Sat, Jun 09, 2018 at 11:34:03PM +0200, Max Reitz wrote:
....
Quoted 5 lines
Quoted 5 lines
Dave was saying that the worst thing about the whole q35 thing is that users download an image and have no idea why it isn't working. Figuring that out may take a long time, because nothing is even throwing an error message.
Quoted 7 lines
Quoted 3 lines
If we had a new format, users couldn't even run it in qemu, so they would quickly figure out that in order to run this VM, they need to update their stack.
Since then users of old software can't use your image at all, then most people simply will not create the new fangled image format.
They will have to because without the new fangles the images just don't work.
Quoted 8 lines
Quoted 4 lines
If we just add this information to qcow2, those users with outdated qemu versions would again have to figure out why the image isn't working.
By that metric compatibility is never worth it unless you have ability to add new functionality retroactively to existing software.
Compatibility is worth it when you add a new extension that is useful but not critical. When the image does not work without interpreting the extended metadata, the failure is hard to diagnose, and old versions of qemu just ignore the extended metadata the extension failed the primary
purpose: making images work out of the box.
Thanks
Michal
Quoted 1 line · Max Reitz
ext2?
I wrote an nbdkit plugin for ext2/ext3/ext4 last week.
https://github.com/libguestfs/nbdkit/tree/master/plugins/ext2
It uses libext2fs from e2fsprogs and I think there are some lessons for anyone who wants to use ext2 to store disk images.
(1) You cannot have more than one host process accessing a single filesystem image, even read-only. This is because opening an ext2+ filesystem even read-only causes writes, replaying the journal (for ext3+) or writing to the superblock.
I'm sure there are some common use-cases such as overlays sharing a common backing store which are excluded by this restriction.
(2) Within a single process you cannot have more than one libext2fs handle open on the filesystem image. This could make qemu block drivers a bit awkward (although not impossible) because if two instances of an ext2 qemu block driver both opened different disks in the same filesystem they'd need to share a handle.
(3) You can resize files in the filesystem, although because we're waiting for the NBD resize extension to be finalized my plugin does not do that.
(4) Trim/discard appears to be possible (and it should be possible to punch holes in the filesystem image) but I couldn't actually understand how to make it work. Also fast zeroing.
Rich.
Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Am 06.06.2018 um 16:55 hat Michael S. Tsirkin geschrieben:
Quoted 14 lines · Eduardo Habkost
Quoted 6 lines
Quoted 2 lines
If we want a grand vision where a single file stores the whole VM, why not invest the work and make it right from the start?
We don't want a grand vision where a single file stores the whole VM. This is exactly what I would like to avoid, by not inventing a whole different appliance file format.
Besides, trying to get a grand vision from the start is a sure way to never have the design leave the drawing board.
What we are asking for at this point is a way to stick a named blob in an image that people can use with qemu without jumping through hoops.
Quoted 6 lines
It seems like a generic enough addition that it seems highly likely to be useful down the road and harmless enough that maintaining it won't become a burden.
Can we agree on that as a first step, so we can build that foundation and move on to actually building ways to use it?
As you don't seem to believe Max, here's my opinion: No.
I'm okay with adding some well-specified information to qcow2 (I'm thinking of a JSON document that is validated against a schema) where the meaning is clear from the qcow2 spec, for all users.
Allowing undefined blobs would add data to qcow2 images whose meaning is only understood by whatever highlevel tool that wrote it, and thereby fragment the one qcow2 format that we have today into many subformats whose specs are scattered all over the net (if they even exist). This is not where I want to go.
So before I'll even think of adding some extra information, we're back to what I already said two weeks ago: Show me what you want to store there. If we go with my proposal to use JSON, show me the JSON schema (with doc comments, obviously) and we'll talk.
Kevin