Skip to contentSkip to conversation

Persistent bitmaps for non-qcow2 formats

Qemu-devel John Snow 10 participants 32 messages Aug 22, 2017 – Sep 6, 2017

lore
Share & tools
lore

John Snow

author
#0 lore raw

Well, we knew we'd want this sooner or later. I've got some pings downstream over whether or not we support persistent bitmaps for non-qcow2 formats.

Currently: no, we don't.

We tried two different ideas for storage agnostic bitmap persistence:

(1) Using qcow2 as a storage container format (similar to VM save states) for information not associated with that particular drive.

This didn't go over so well; we decided it was too messy logistically to manage data in any meaningful sense in a file that didn't share any semantic relationship to the qcow2 in question.

Well, "We" decided is more like "Kevin and Max" decided. They are right, though.

(2) Using a new proto-wrapper format that Fam Zheng designed that serves as a simple top-layer redirect for metadata that allows us to associate raw bitmap data with an arbitrary backing image.

This also didn't go over so well, the desire for a "new format" was pretty thin, even if it was only a pseudo-format.

We'd still like to be able to use bitmaps with non-qcow2 formats however, and people are going to keep asking. So here's a third thought:

(3) Add either a new flag that turns qcow2's backing file into a full R/W backing file, or add a new extension to qcow2 entirely (bypassing the traditional backing file mechanism to avoid confusion for older tooling) that adds a new read-write backing file field.

This RW backing file field will be used for all reads AND writes; the qcow2 in question becomes a metadata container on top of the BDS chain. We can re-use Vladimir's bitmap persistence extension to save bitmaps in a qcow2 shell.

The qcow2 becomes effectively a metadata cache for a new (essentially) filter node that handles features such as bitmaps. This could also be used to provide allocation map data for RAW files and other goodies down the road.

Hopefully this achieves our desire to not create new formats AND our desire to concentrate features (and debugging, testing, etc) into qcow2, while allowing users to "have bitmaps with raw files."

Of course, in this scenario, users now have two files: a qcow2 wrapper and the actual raw file in question; but regardless of how we were going to solve this, a raw file necessitates an external file of some sort, else we give up the idea that it was a raw file.

Sound good?

#1 lore raw
Quoted 51 lines · John Snow

Well, we knew we'd want this sooner or later. I've got some pings downstream over whether or not we support persistent bitmaps for non-qcow2 formats.

Currently: no, we don't.

We tried two different ideas for storage agnostic bitmap persistence:

(1) Using qcow2 as a storage container format (similar to VM save states) for information not associated with that particular drive.

This didn't go over so well; we decided it was too messy logistically to manage data in any meaningful sense in a file that didn't share any semantic relationship to the qcow2 in question.

Well, "We" decided is more like "Kevin and Max" decided. They are right, though.

(2) Using a new proto-wrapper format that Fam Zheng designed that serves as a simple top-layer redirect for metadata that allows us to associate raw bitmap data with an arbitrary backing image.

This also didn't go over so well, the desire for a "new format" was pretty thin, even if it was only a pseudo-format.

We'd still like to be able to use bitmaps with non-qcow2 formats however, and people are going to keep asking. So here's a third thought:

(3) Add either a new flag that turns qcow2's backing file into a full R/W backing file, or add a new extension to qcow2 entirely (bypassing the traditional backing file mechanism to avoid confusion for older tooling) that adds a new read-write backing file field.

This RW backing file field will be used for all reads AND writes; the qcow2 in question becomes a metadata container on top of the BDS chain. We can re-use Vladimir's bitmap persistence extension to save bitmaps in a qcow2 shell.

The qcow2 becomes effectively a metadata cache for a new (essentially) filter node that handles features such as bitmaps. This could also be used to provide allocation map data for RAW files and other goodies down the road.

Hopefully this achieves our desire to not create new formats AND our desire to concentrate features (and debugging, testing, etc) into qcow2, while allowing users to "have bitmaps with raw files."

Quoted 7 lines

Of course, in this scenario, users now have two files: a qcow2 wrapper and the actual raw file in question; but regardless of how we were going to solve this, a raw file necessitates an external file of some sort, else we give up the idea that it was a raw file.

Sound good?

Looks interesting. It is a clean reusing of qcow2-bitmaps without any modifications to them.

Should there be some problems with internal snapshots and other things?

Signature · 2 lines
Best regards,
Vladimir
#2 lore raw
Quoted 58 lines · Vladimir Sementsov-Ogievskiy
Quoted 57 lines · John Snow

Well, we knew we'd want this sooner or later. I've got some pings downstream over whether or not we support persistent bitmaps for non-qcow2 formats.

Currently: no, we don't.

We tried two different ideas for storage agnostic bitmap persistence:

(1) Using qcow2 as a storage container format (similar to VM save states) for information not associated with that particular drive.

This didn't go over so well; we decided it was too messy logistically to manage data in any meaningful sense in a file that didn't share any semantic relationship to the qcow2 in question.

Well, "We" decided is more like "Kevin and Max" decided. They are right, though.

(2) Using a new proto-wrapper format that Fam Zheng designed that serves as a simple top-layer redirect for metadata that allows us to associate raw bitmap data with an arbitrary backing image.

This also didn't go over so well, the desire for a "new format" was pretty thin, even if it was only a pseudo-format.

We'd still like to be able to use bitmaps with non-qcow2 formats however, and people are going to keep asking. So here's a third thought:

(3) Add either a new flag that turns qcow2's backing file into a full R/W backing file, or add a new extension to qcow2 entirely (bypassing the traditional backing file mechanism to avoid confusion for older tooling) that adds a new read-write backing file field.

This RW backing file field will be used for all reads AND writes; the qcow2 in question becomes a metadata container on top of the BDS chain. We can re-use Vladimir's bitmap persistence extension to save bitmaps in a qcow2 shell.

The qcow2 becomes effectively a metadata cache for a new (essentially) filter node that handles features such as bitmaps. This could also be used to provide allocation map data for RAW files and other goodies down the road.

Hopefully this achieves our desire to not create new formats AND our desire to concentrate features (and debugging, testing, etc) into qcow2, while allowing users to "have bitmaps with raw files."

Of course, in this scenario, users now have two files: a qcow2 wrapper and the actual raw file in question; but regardless of how we were going to solve this, a raw file necessitates an external file of some sort, else we give up the idea that it was a raw file.

Quoted 8 lines
Quoted 1 line

Sound good?

Looks interesting. It is a clean reusing of qcow2-bitmaps without any modifications to them.

Should there be some problems with internal snapshots and other things?

Hm. looks like that this backing file should not only receive all reads and writes, but almost everything ->bdrv_ handlers, except bitmap related of course. This doesn't seems simple to implement. Especially if imaging some not-raw feature-full format under this thin qcow2 layer.. Or we can restrict this RW backing file to be raw-only?

Signature · 2 lines
Best regards,
Vladimir
#3 lore raw
Quoted 61 lines · Vladimir Sementsov-Ogievskiy
Quoted 60 lines · Vladimir Sementsov-Ogievskiy
Quoted 58 lines · John Snow

Well, we knew we'd want this sooner or later. I've got some pings downstream over whether or not we support persistent bitmaps for non-qcow2 formats.

Currently: no, we don't.

We tried two different ideas for storage agnostic bitmap persistence:

(1) Using qcow2 as a storage container format (similar to VM save states) for information not associated with that particular drive.

This didn't go over so well; we decided it was too messy logistically to manage data in any meaningful sense in a file that didn't share any semantic relationship to the qcow2 in question.

Well, "We" decided is more like "Kevin and Max" decided. They are right, though.

(2) Using a new proto-wrapper format that Fam Zheng designed that serves as a simple top-layer redirect for metadata that allows us to associate raw bitmap data with an arbitrary backing image.

This also didn't go over so well, the desire for a "new format" was pretty thin, even if it was only a pseudo-format.

We'd still like to be able to use bitmaps with non-qcow2 formats however, and people are going to keep asking. So here's a third thought:

(3) Add either a new flag that turns qcow2's backing file into a full R/W backing file, or add a new extension to qcow2 entirely (bypassing the traditional backing file mechanism to avoid confusion for older tooling) that adds a new read-write backing file field.

This RW backing file field will be used for all reads AND writes; the qcow2 in question becomes a metadata container on top of the BDS chain. We can re-use Vladimir's bitmap persistence extension to save bitmaps in a qcow2 shell.

The qcow2 becomes effectively a metadata cache for a new (essentially) filter node that handles features such as bitmaps. This could also be used to provide allocation map data for RAW files and other goodies down the road.

Hopefully this achieves our desire to not create new formats AND our desire to concentrate features (and debugging, testing, etc) into qcow2, while allowing users to "have bitmaps with raw files."

Of course, in this scenario, users now have two files: a qcow2 wrapper and the actual raw file in question; but regardless of how we were going to solve this, a raw file necessitates an external file of some sort, else we give up the idea that it was a raw file.

Sound good?

Quoted 9 lines
Quoted 6 lines

Looks interesting. It is a clean reusing of qcow2-bitmaps without any modifications to them.

Should there be some problems with internal snapshots and other things?

Hm. looks like that this backing file should not only receive all reads and writes, but almost everything ->bdrv_ handlers, except bitmap related of course. This doesn't seems simple to implement. Especially if imaging some not-raw feature-full format under this thin qcow2 layer.. Or we can restrict this RW backing file to be raw-only?

So, anyway, I see only two differences (from the outside) between this approach and just a separate bitmap-only qcow2 without a data:

1. in RW-backing approach qcow2-bitmap file has a link to data file (as a backing). It looks good.

2. in RW-backing approach qcow2-bitmap file is a top of the virtual disk, in separate-file approach it is an option of the real data drive. In my opinion the second is more clean for users ("to add this feature you should use other file as your disk" vs "to add this feature you should add an option to your disk description")

I think (may be I'm not right) loading bitmaps from additional qcow2-only-bitmaps file is simpler to implement (it will be specified in command line in drive options, like bitmaps_file=/path/to/it and then attached directly to BlockDriverState). The only drawback of simple qcow2-bitmap file  is that it has not a link inside it to the data file (like shabacking). We can ignore it, or we can implement this link as a separate extension to qcow2.

Signature · 2 lines
Best regards,
Vladimir
author
#4 lore raw
In reply to Vladimir Sementsov-Ogievskiy

Sorry in advance for :words: ...

Quoted 68 lines · Vladimir Sementsov-Ogievskiy
Quoted 58 lines · Vladimir Sementsov-Ogievskiy
Quoted 57 lines · John Snow

Well, we knew we'd want this sooner or later. I've got some pings downstream over whether or not we support persistent bitmaps for non-qcow2 formats.

Currently: no, we don't.

We tried two different ideas for storage agnostic bitmap persistence:

(1) Using qcow2 as a storage container format (similar to VM save states) for information not associated with that particular drive.

This didn't go over so well; we decided it was too messy logistically to manage data in any meaningful sense in a file that didn't share any semantic relationship to the qcow2 in question.

Well, "We" decided is more like "Kevin and Max" decided. They are right, though.

(2) Using a new proto-wrapper format that Fam Zheng designed that serves as a simple top-layer redirect for metadata that allows us to associate raw bitmap data with an arbitrary backing image.

This also didn't go over so well, the desire for a "new format" was pretty thin, even if it was only a pseudo-format.

We'd still like to be able to use bitmaps with non-qcow2 formats however, and people are going to keep asking. So here's a third thought:

(3) Add either a new flag that turns qcow2's backing file into a full R/W backing file, or add a new extension to qcow2 entirely (bypassing the traditional backing file mechanism to avoid confusion for older tooling) that adds a new read-write backing file field.

This RW backing file field will be used for all reads AND writes; the qcow2 in question becomes a metadata container on top of the BDS chain. We can re-use Vladimir's bitmap persistence extension to save bitmaps in a qcow2 shell.

The qcow2 becomes effectively a metadata cache for a new (essentially) filter node that handles features such as bitmaps. This could also be used to provide allocation map data for RAW files and other goodies down the road.

Hopefully this achieves our desire to not create new formats AND our desire to concentrate features (and debugging, testing, etc) into qcow2, while allowing users to "have bitmaps with raw files."

Of course, in this scenario, users now have two files: a qcow2 wrapper and the actual raw file in question; but regardless of how we were going to solve this, a raw file necessitates an external file of some sort, else we give up the idea that it was a raw file.

Quoted 9 lines
Quoted 1 line

Sound good?

Looks interesting. It is a clean reusing of qcow2-bitmaps without any modifications to them.

Should there be some problems with internal snapshots and other things?

Quoted 7 lines

Hm. looks like that this backing file should not only receive all reads and writes, but almost everything ->bdrv_ handlers, except bitmap related of course. This doesn't seems simple to implement. Especially if imaging some not-raw feature-full format under this thin qcow2 layer.. Or we can restrict this RW backing file to be raw-only?

The idea would really be to support any arbitrary data store, so I wouldn't want to restrict it to just raw.

You're right though, this might be a kind of messy approach.

[From your other mail:]

Quoted 3 lines

So, anyway, I see only two differences (from the outside) between this approach and just a separate bitmap-only qcow2 without a data:

It's very delicately similar, yes.

Quoted 2 lines

1. in RW-backing approach qcow2-bitmap file has a link to data file (as a backing). It looks good.

Right. The information necessary to establish a link between the bitmap data and the data being described is fully contained within a file fully specified by the QCOW2 spec.

Quoted 1 line

2. in RW-backing approach qcow2-bitmap file is a top of the virtual disk, in separate-file approach it is an option of the real data drive. In my opinion the second is more clean for users ("to add this feature you should use other file as your disk" vs "to add this feature you should add an option to your disk description")

This puts us a little closer to the original idea that was rejected by Kevin at the time. To recap:

"1": Use qcow2 as a container. This was rejected because we didn't want qcow2 containing data with no semantic relationship to the qcow2 container or to each other. The way it sounds like you're proposing it, though, it would be one-qcow2-with-bitmaps-per-drive, so the data would at least stay strictly related, but it would be meaningless outside of QEMU itself. I think this is something that Kevin wanted to avoid, but I can't speak for him.

It's certainly not beyond the realm of management software to remember to correlate a qcow2 metadata file alongside its actual data stores whenever it needed to do so, but it does mean the introduction of a feature that essentially requires the use of management software, which sees resistance in the community at times.

In this model, you'd probably have the raw drive at the top, with the qcow2-with-bitmaps as a child node with some kind of new named child relationship. All IO stays at the root node, but the bitmap method handlers would know to look for this special bitmap-child. It shouldn't be too hard to implement.

Quoted 3 lines

I think (may be I'm not right) loading bitmaps from additional qcow2-only-bitmaps file is simpler to implement (it will be specified in command line in drive options, like bitmaps_file=/path/to/it and then attached directly to BlockDriverState). The only drawback of simple qcow2-bitmap file is that it has not a link inside it to the data file (like shabacking). We can ignore it, or we can implement this link as a separate extension to qcow2.

Yes, definitely easier to implement as you say.

The hard part is going to come in defining that semantic link. At this point, the only difference between the approaches is whether or not we allow the qcow2 to point to the implementation of the data;

(1) The qcow2 is referenced by name from the CLI as an option to the other drive.

(2) The qcow2 is referenced by name on the CLI, and its backing file field intuits the location of the implementation storage.

In (1), we avoid saving or specifying the relationship between these two data stores in any way. This is certainly easy to do, and will save us some headache on the CLI. As a downside, we now have random orphaned files that aren't very interesting or useful on their own. The likelihood for desync between metadata and data increases. The use of management software is all but necessitated.

In (2) We have to now specify, with a dizzying long list of possibilities, the location of the implementation data. qcow2 only has a filename for backing files presently, but this is likely inadequate. What if the data store isn't a locally kept file? What if it's a socket, or a stream, or literally anything else?

We'd have to develop a new syntax for specifying these resources that can be stored in a qcow2 file, or otherwise co-opt an existing syntax in-use by QEMU. This syntax would likely be useful only to QEMU, which would steer the qcow2 format in a direction not too useful by other emulators, and qcow2 is an open format, so we may want to avoid this.

I feel like what will make the difference between heading down either path would be helped along by answers to these questions:

- What type of data stores do we wish to support with bitmaps? Simple file-based ones, or the full spectrum of all types? Only qcow2, and to hell with people who ask for otherwise?

- How important is it that the qcow2 remains a fully independent file capable of describing its own relationship to the data?

- Is it OK to allow robust, QEMU-specific data descriptors in a qcow2 file?

Where I sit:

- I'd like to support truly arbitrary protocols and formats. We can add transient / non-persistent bitmaps to any of these today, so I'd like to maintain that flexibility.

- I think it will be difficult or impossible to agree upon a specification for the syntax to store the backing storage identifier in the qcow2 itself, because we'd like to let third party tools make use of qcow2 files.

- I don't think Kevin will like the idea of us using qcow2 as a container that does not get treated as a first class citizen in the backing chain, but it's the easiest option to implement and avoids a lot of the syntax-of-backing-storage questions.

- There's a definite usability factor to having the qcow2 just specify where the rest of the data sits like it does for normal backing files, but with what I am proposing, this complicates the open() call considerably, not to mention the syntactic issues addressed above.

I guess I've talked myself out of wanting a "RW backing file" because it seems hard to implement, spec-wise ...

--js

#5 lore raw
Quoted 185 lines · John Snow

Sorry in advance for :words: ...

Quoted 67 lines · Vladimir Sementsov-Ogievskiy
Quoted 58 lines · Vladimir Sementsov-Ogievskiy
Quoted 57 lines · John Snow

Well, we knew we'd want this sooner or later. I've got some pings downstream over whether or not we support persistent bitmaps for non-qcow2 formats.

Currently: no, we don't.

We tried two different ideas for storage agnostic bitmap persistence:

(1) Using qcow2 as a storage container format (similar to VM save states) for information not associated with that particular drive.

This didn't go over so well; we decided it was too messy logistically to manage data in any meaningful sense in a file that didn't share any semantic relationship to the qcow2 in question.

Well, "We" decided is more like "Kevin and Max" decided. They are right, though.

(2) Using a new proto-wrapper format that Fam Zheng designed that serves as a simple top-layer redirect for metadata that allows us to associate raw bitmap data with an arbitrary backing image.

This also didn't go over so well, the desire for a "new format" was pretty thin, even if it was only a pseudo-format.

We'd still like to be able to use bitmaps with non-qcow2 formats however, and people are going to keep asking. So here's a third thought:

(3) Add either a new flag that turns qcow2's backing file into a full R/W backing file, or add a new extension to qcow2 entirely (bypassing the traditional backing file mechanism to avoid confusion for older tooling) that adds a new read-write backing file field.

This RW backing file field will be used for all reads AND writes; the qcow2 in question becomes a metadata container on top of the BDS chain. We can re-use Vladimir's bitmap persistence extension to save bitmaps in a qcow2 shell.

The qcow2 becomes effectively a metadata cache for a new (essentially) filter node that handles features such as bitmaps. This could also be used to provide allocation map data for RAW files and other goodies down the road.

Hopefully this achieves our desire to not create new formats AND our desire to concentrate features (and debugging, testing, etc) into qcow2, while allowing users to "have bitmaps with raw files."

Of course, in this scenario, users now have two files: a qcow2 wrapper and the actual raw file in question; but regardless of how we were going to solve this, a raw file necessitates an external file of some sort, else we give up the idea that it was a raw file.

Quoted 8 lines
Quoted 1 line

Sound good?

Looks interesting. It is a clean reusing of qcow2-bitmaps without any modifications to them.

Should there be some problems with internal snapshots and other things?

Quoted 7 lines

Hm. looks like that this backing file should not only receive all reads and writes, but almost everything ->bdrv_ handlers, except bitmap related of course. This doesn't seems simple to implement. Especially if imaging some not-raw feature-full format under this thin qcow2 layer.. Or we can restrict this RW backing file to be raw-only?

The idea would really be to support any arbitrary data store, so I wouldn't want to restrict it to just raw.

You're right though, this might be a kind of messy approach.

[From your other mail:]

Quoted 2 lines

So, anyway, I see only two differences (from the outside) between this approach and just a separate bitmap-only qcow2 without a data:

It's very delicately similar, yes.

Quoted 2 lines

1. in RW-backing approach qcow2-bitmap file has a link to data file (as a backing). It looks good.

Right. The information necessary to establish a link between the bitmap data and the data being described is fully contained within a file fully specified by the QCOW2 spec.

Quoted 1 line

2. in RW-backing approach qcow2-bitmap file is a top of the virtual disk, in separate-file approach it is an option of the real data drive. In my opinion the second is more clean for users ("to add this feature you should use other file as your disk" vs "to add this feature you should add an option to your disk description")

This puts us a little closer to the original idea that was rejected by Kevin at the time. To recap:

"1": Use qcow2 as a container. This was rejected because we didn't want qcow2 containing data with no semantic relationship to the qcow2 container or to each other. The way it sounds like you're proposing it, though, it would be one-qcow2-with-bitmaps-per-drive, so the data would at least stay strictly related, but it would be meaningless outside of QEMU itself. I think this is something that Kevin wanted to avoid, but I can't speak for him.

It's certainly not beyond the realm of management software to remember to correlate a qcow2 metadata file alongside its actual data stores whenever it needed to do so, but it does mean the introduction of a feature that essentially requires the use of management software, which sees resistance in the community at times.

In this model, you'd probably have the raw drive at the top, with the qcow2-with-bitmaps as a child node with some kind of new named child relationship. All IO stays at the root node, but the bitmap method handlers would know to look for this special bitmap-child. It shouldn't be too hard to implement.

Quoted 2 lines

I think (may be I'm not right) loading bitmaps from additional qcow2-only-bitmaps file is simpler to implement (it will be specified in command line in drive options, like bitmaps_file=/path/to/it and then attached directly to BlockDriverState). The only drawback of simple qcow2-bitmap file is that it has not a link inside it to the data file (like shabacking). We can ignore it, or we can implement this link as a separate extension to qcow2.

Yes, definitely easier to implement as you say.

The hard part is going to come in defining that semantic link. At this point, the only difference between the approaches is whether or not we allow the qcow2 to point to the implementation of the data;

(1) The qcow2 is referenced by name from the CLI as an option to the other drive.

(2) The qcow2 is referenced by name on the CLI, and its backing file field intuits the location of the implementation storage.

In (1), we avoid saving or specifying the relationship between these two data stores in any way. This is certainly easy to do, and will save us some headache on the CLI. As a downside, we now have random orphaned files that aren't very interesting or useful on their own. The likelihood for desync between metadata and data increases. The use of management software is all but necessitated.

In (2) We have to now specify, with a dizzying long list of possibilities, the location of the implementation data. qcow2 only has a filename for backing files presently, but this is likely inadequate. What if the data store isn't a locally kept file? What if it's a socket, or a stream, or literally anything else?

We'd have to develop a new syntax for specifying these resources that can be stored in a qcow2 file, or otherwise co-opt an existing syntax in-use by QEMU. This syntax would likely be useful only to QEMU, which would steer the qcow2 format in a direction not too useful by other emulators, and qcow2 is an open format, so we may want to avoid this.

I feel like what will make the difference between heading down either path would be helped along by answers to these questions:

- What type of data stores do we wish to support with bitmaps? Simple file-based ones, or the full spectrum of all types? Only qcow2, and to hell with people who ask for otherwise?

- How important is it that the qcow2 remains a fully independent file capable of describing its own relationship to the data?

- Is it OK to allow robust, QEMU-specific data descriptors in a qcow2 file?

Where I sit:

- I'd like to support truly arbitrary protocols and formats. We can add transient / non-persistent bitmaps to any of these today, so I'd like to maintain that flexibility.

- I think it will be difficult or impossible to agree upon a specification for the syntax to store the backing storage identifier in the qcow2 itself, because we'd like to let third party tools make use of qcow2 files.

- I don't think Kevin will like the idea of us using qcow2 as a container that does not get treated as a first class citizen in the backing chain, but it's the easiest option to implement and avoids a lot of the syntax-of-backing-storage questions.

Quoted 4 lines

- There's a definite usability factor to having the qcow2 just specify where the rest of the data sits like it does for normal backing files, but with what I am proposing, this complicates the open() call considerably, not to mention the syntactic issues addressed above.

Is it difficult to add an additional file link - like backing, and just use it in qcow2 code (not on generic level) instead of bs->file for all data (not metadata) io? So that, l2 table entries will point to clusters in this separate file.

Quoted 7 lines

I guess I've talked myself out of wanting a "RW backing file" because it seems hard to implement, spec-wise ...

--js

Signature · 2 lines
Best regards,
Vladimir
#6 lore raw
In reply to John Snow
Quoted 68 lines · John Snow

Sorry in advance for :words: ...

Quoted 65 lines · Vladimir Sementsov-Ogievskiy
Quoted 64 lines · Vladimir Sementsov-Ogievskiy
Quoted 51 lines · John Snow

Well, we knew we'd want this sooner or later. I've got some pings downstream over whether or not we support persistent bitmaps for non-qcow2 formats.

Currently: no, we don't.

We tried two different ideas for storage agnostic bitmap persistence:

(1) Using qcow2 as a storage container format (similar to VM save states) for information not associated with that particular drive.

This didn't go over so well; we decided it was too messy logistically to manage data in any meaningful sense in a file that didn't share any semantic relationship to the qcow2 in question.

Well, "We" decided is more like "Kevin and Max" decided. They are right, though.

(2) Using a new proto-wrapper format that Fam Zheng designed that serves as a simple top-layer redirect for metadata that allows us to associate raw bitmap data with an arbitrary backing image.

This also didn't go over so well, the desire for a "new format" was pretty thin, even if it was only a pseudo-format.

We'd still like to be able to use bitmaps with non-qcow2 formats however, and people are going to keep asking. So here's a third thought:

(3) Add either a new flag that turns qcow2's backing file into a full R/W backing file, or add a new extension to qcow2 entirely (bypassing the traditional backing file mechanism to avoid confusion for older tooling) that adds a new read-write backing file field.

This RW backing file field will be used for all reads AND writes; the qcow2 in question becomes a metadata container on top of the BDS chain. We can re-use Vladimir's bitmap persistence extension to save bitmaps in a qcow2 shell.

The qcow2 becomes effectively a metadata cache for a new (essentially) filter node that handles features such as bitmaps. This could also be used to provide allocation map data for RAW files and other goodies down the road.

Hopefully this achieves our desire to not create new formats AND our desire to concentrate features (and debugging, testing, etc) into qcow2, while allowing users to "have bitmaps with raw files."

Quoted 7 lines

Of course, in this scenario, users now have two files: a qcow2 wrapper and the actual raw file in question; but regardless of how we were going to solve this, a raw file necessitates an external file of some sort, else we give up the idea that it was a raw file.

Sound good?

Looks interesting. It is a clean reusing of qcow2-bitmaps without any modifications to them.

Should there be some problems with internal snapshots and other things?

I'd suspect you get exactly the same problems when using internal snapshots together with backing files. Imagine a newly created overlay file and taking a snapshot. This should give you exactly the same issue, doesn't it?

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Hm. looks like that this backing file should not only receive all reads and writes, but almost everything ->bdrv_ handlers, except bitmap related of course.

How so? Shouldn't it just work like a backing file, except it also receives writes instead of just reads?

Quoted 11 lines
Quoted 5 lines

This doesn't seems simple to implement. Especially if
imaging some not-raw feature-full format under this thin qcow2 layer.. Or we can restrict this RW backing file to be raw-only?

The idea would really be to support any arbitrary data store, so I wouldn't want to restrict it to just raw.

You're right though, this might be a kind of messy approach.

Quoted 9 lines

[From your other mail:]

Quoted 3 lines

So, anyway, I see only two differences (from the outside) between this approach and just a separate bitmap-only qcow2 without a data:

It's very delicately similar, yes.

Quoted 1 line

1. in RW-backing approach qcow2-bitmap file has a link to data file (as a backing). It looks good.

And this is rather important to me.

Quoted 5 lines

Right. The information necessary to establish a link between the bitmap data and the data being described is fully contained within a file fully specified by the QCOW2 spec.

Quoted 1 line

2. in RW-backing approach qcow2-bitmap file is a top of the virtual disk, in separate-file approach it is an option of the real data drive. In my opinion the second is more clean for users ("to add this feature you should use other file as your disk" vs "to add this feature you should add an option to your disk description")

I'd argue it's rather: "You cannot use this feature unless your format supports it. The only format supporting persistent bitmaps currently is qcow2. To use persistent bitmaps with other formats you can attach them as R/W backing files to an empty qcow2 file, though."

So the difference is that you are saying it's a feature that is added to a non-qcow2 image whereas I'm saying it's a feature that only a qcow2 image can provide (currently).

Quoted 17 lines

This puts us a little closer to the original idea that was rejected by Kevin at the time. To recap:

"1": Use qcow2 as a container. This was rejected because we didn't want qcow2 containing data with no semantic relationship to the qcow2 container or to each other. The way it sounds like you're proposing it, though, it would be one-qcow2-with-bitmaps-per-drive, so the data would at least stay strictly related, but it would be meaningless outside of QEMU itself. I think this is something that Kevin wanted to avoid, but I can't speak for him.

It's certainly not beyond the realm of management software to remember to correlate a qcow2 metadata file alongside its actual data stores whenever it needed to do so, but it does mean the introduction of a feature that essentially requires the use of management software, which sees resistance in the community at times.

Quoted 5 lines

In this model, you'd probably have the raw drive at the top, with the qcow2-with-bitmaps as a child node with some kind of new named child relationship. All IO stays at the root node, but the bitmap method handlers would know to look for this special bitmap-child. It shouldn't be too hard to implement.

I'd still like to throw in how much I dislike this approach, and I can't really think of a way to make it palatable to me. Not even "just write the file name of the image the bitmaps cover into the qcow2 file" sounds good to me, because then it still is basically unrelated data.

The only approach that I might see myself liking is to indeed add a flag or whatever to say a qcow2 backing image is supposed to be R/W; and then (after somehow verifying that the qcow2 image itself is empty) just make qemu interpret this as "load the backing file as the real disk and attach the qcow2 image as a 'metadata' child" or whatever. But I fear this gets uglier and uglier because how qemu loads the files will then depend on whether the overlay is empty or not, and this may be very confusing.

Quoted 22 lines
Quoted 1 line

I think (may be I'm not right) loading bitmaps from additional qcow2-only-bitmaps file is simpler to implement (it will be specified in command line in drive options, like bitmaps_file=/path/to/it and then attached directly to BlockDriverState). The only drawback of simple qcow2-bitmap file is that it has not a link inside it to the data file (like backing). We can ignore it, or we can implement this link as a separate extension to qcow2.

Yes, definitely easier to implement as you say.

The hard part is going to come in defining that semantic link. At this point, the only difference between the approaches is whether or not we allow the qcow2 to point to the implementation of the data;

(1) The qcow2 is referenced by name from the CLI as an option to the other drive.

(2) The qcow2 is referenced by name on the CLI, and its backing file field intuits the location of the implementation storage.

In (1), we avoid saving or specifying the relationship between these two data stores in any way. This is certainly easy to do, and will save us some headache on the CLI. As a downside, we now have random orphaned files that aren't very interesting or useful on their own. The likelihood for desync between metadata and data increases. The use of management software is all but necessitated.

Quoted 5 lines

In (2) We have to now specify, with a dizzying long list of possibilities, the location of the implementation data. qcow2 only has a filename for backing files presently, but this is likely inadequate. What if the data store isn't a locally kept file? What if it's a socket, or a stream, or literally anything else?

I don't see the difference. In (1), your data image gets a "bitmap" or "metadata" child. In (2), your qcow2 image gets the usual "backing" child, or maybe call it "passthrough" or whatever, if you want to make the difference more explicit than just passing an option to the qcow2 image to pass writes to its backing file.

Quoted 2 lines

We'd have to develop a new syntax for specifying these resources that can be stored in a qcow2 file,

It's called the json-pseudo-protocol and was developed exactly for this.

Quoted 4 lines

or otherwise co-opt an existing syntax
in-use by QEMU. This syntax would likely be useful only to QEMU, which would steer the qcow2 format in a direction not too useful by other emulators, and qcow2 is an open format, so we may want to avoid this.

Storing a file name in the backing link field that cannot be interpreted by other programs is in my opinion still very much better than not storing any information whatsoever, because in the former case other programs can at least say "sorry, I have no idea what this means" (or maybe they can indeed interpret it, who knows), whereas in the latter they may not even know that the qcow2 image is incomplete.

Also note that we are making an effort to be able to generate plain file names (such as URLs which should be usable by other programs) whenever possible.

Quoted 6 lines

I feel like what will make the difference between heading down either path would be helped along by answers to these questions:

- What type of data stores do we wish to support with bitmaps? Simple file-based ones, or the full spectrum of all types? Only qcow2, and to hell with people who ask for otherwise?

I don't really know how this question relates to the issue other than "If we only want to support qcow2, the whole discussion is moot; since this discussion exists, we apparently do want to support something other than qcow2 at some point."

Well, OK. The main argument against supporting anything but qcow2 is "if you want features, use qcow2; and we are working on making qcow2 as fast as possible." I think that's a very good argument still. At some point I (and probably others, too) had the idea of making qcow2 files in raw layout: Have the data as a blob, just like a raw file, padded by metadata around it. An autoclear flag would specify that the qcow2 file is in this format, and if so, you could simply access it like a raw file and should have exactly the same speed as a raw file. Maybe that would solve this whole issue, too?

And as for non-file based backing files, see above.

Quoted 2 lines

- How important is it that the qcow2 remains a fully independent file capable of describing its own relationship to the data?

Technically not important. To me, very important.

Quoted 1 line

- Is it OK to allow robust, QEMU-specific data descriptors in a qcow2 file?

Depends. At least Red Hat's QA does use json file names, so there's already that.

I think QEMU-specific is OK as long as it still makes sense, as long as there is no other way, and as long as there is some kind of documentation still.

Technically, you can always put QEMU-specific stuff into the qcow2 specification and thus make it generic.

Quoted 1 line

Where I sit:

[...]

Quoted 4 lines

- I don't think Kevin will like the idea of us using qcow2 as a container that does not get treated as a first class citizen in the backing chain, but it's the easiest option to implement and avoids a lot of the syntax-of-backing-storage questions.

I'd like to throw in that I was not at all opposed to Fam's approach of having an independent format (tar, wasn't it?) just for storing bitmaps.
I know Kevin was, but I don't quite remember why. Probably because it
was a real format, but a very strange one, and then implementing it through the block layer was weird...?

OTOH, there is one issue I have with the R/W backing approach: Every request to the raw file has to go through the qcow2 layer. And since you probably want to use raw because of the speed, this is not so nice.

Max

#7 lore raw
Quoted 5 lines · Max Reitz

Well, OK. The main argument against supporting anything but qcow2 is "if you want features, use qcow2; and we are working on making qcow2 as fast as possible." I think that's a very good argument still. At some point I (and probably others, too) had the idea of making qcow2 files in raw layout:

Yes! I think this idea makes a whole lot of sense, too. Metadata tables can be generated so old implementation can still use it.

Fam

Quoted 5 lines

Have the data as a blob, just like a raw file, padded by metadata around it. An autoclear flag would specify that the qcow2 file is in this format, and if so, you could simply access it like a raw file and should have exactly the same speed as a raw file. Maybe that would solve this whole issue, too?

author
#8 lore raw
Quoted 8 lines · Fam Zheng
Quoted 5 lines · Max Reitz

Well, OK. The main argument against supporting anything but qcow2 is "if you want features, use qcow2; and we are working on making qcow2 as fast as possible." I think that's a very good argument still. At some point I (and probably others, too) had the idea of making qcow2 files in raw layout:

Quoted 10 lines

Yes! I think this idea makes a whole lot of sense, too. Metadata tables can be generated so old implementation can still use it.

Fam

Quoted 5 lines

Have the data as a blob, just like a raw file, padded by metadata around it. An autoclear flag would specify that the qcow2 file is in this format, and if so, you could simply access it like a raw file and should have exactly the same speed as a raw file. Maybe that would solve this whole issue, too?

I wonder if this would be sufficient to alleviate the desire to use raw files...

(Eh, well, realistically, someone's still always going to ask if they can use various features with non-qcow2 files...)

Nir, Yaniv; any input?

(Context: We're debating how to add persistent bitmaps to raw files as I was informed that RHV was 'asking about it.' Max is reminding me there is a proposal for a style of QCOW2 that uses a raw layout for data, mitigating or eliminating any performance hits related to the L2 cache. What I am not aware of is why RHV would use raw files for any purpose. Is it performance? Simplicity? Could RHV use a raw-layout qcow2?)

--js

#9 lore raw

YANIV LAVI (YANIV DARY)

SENIOR TECHNICAL PRODUCT MANAGER

Red Hat Israel Ltd. <https://www.redhat.com/>

34 Jerusalem Road, Building A, 1st floor

Ra'anana, Israel 4350109

[email protected] T: +972-9-7692306/8272306 F: +972-9-7692223 IM: ylavi
<https://red.ht/sig> TRIED. TESTED. TRUSTED. <https://redhat.com/trusted>
@redhatnews <https://twitter.com/redhatnews> Red Hat
<https://www.linkedin.com/company/red-hat> Red Hat
<https://www.facebook.com/RedHatInc>

Quoted 23 lines · John Snow
Quoted 9 lines · Fam Zheng
Quoted 5 lines · Max Reitz

Well, OK. The main argument against supporting anything but qcow2 is "if you want features, use qcow2; and we are working on making qcow2 as fast as possible." I think that's a very good argument still. At some point I (and probably others, too) had the idea of making qcow2 files in raw layout:

Yes! I think this idea makes a whole lot of sense, too. Metadata tables

can be

Quoted 9 lines

generated so old implementation can still use it.

Fam

Quoted 5 lines

Have the data as a blob, just like a raw file, padded by metadata around it. An autoclear flag would specify that the qcow2 file is in this format, and if so, you could simply access it like a raw file and should have exactly the same speed as a raw file. Maybe that would solve this whole issue, too?

Quoted 8 lines

I wonder if this would be sufficient to alleviate the desire to use raw files...

(Eh, well, realistically, someone's still always going to ask if they can use various features with non-qcow2 files...)

Nir, Yaniv; any input?

We are using raw format for performance reasons.
As we have many customers that currently use this format, not support it would be a blocker the use of the feature.
At a minimum we would require ability to convert raw to qcow2 raw-layout.

Please also consider that we are planning to go on the OSP route of LUN per disk and would still want the tracking to work.
I makes sense that for that and raw format you will be able to save the mapping to another file other than a qcow.

Quoted 10 lines

(Context: We're debating how to add persistent bitmaps to raw files as I was informed that RHV was 'asking about it.' Max is reminding me there is a proposal for a style of QCOW2 that uses a raw layout for data, mitigating or eliminating any performance hits related to the L2 cache. What I am not aware of is why RHV would use raw files for any purpose. Is it performance? Simplicity? Could RHV use a raw-layout qcow2?)

--js

#10 lore raw
Quoted 58 lines · Yaniv Lavi (Dary)

YANIV LAVI (YANIV DARY)

SENIOR TECHNICAL PRODUCT MANAGER

Red Hat Israel Ltd. <https://www.redhat.com/>

34 Jerusalem Road, Building A, 1st floor

Ra'anana, Israel 4350109

[email protected] <mailto:[email protected]>    T: +972-9-7692306 <tel:+972-9-7692306>/8272306 <tel:8272306>     F: +972-9-7692223 <tel:+972-9-7692223>    IM: ylavi

<https://red.ht/sig> TRIED. TESTED. TRUSTED. <https://redhat.com/trusted>

@redhatnews <https://twitter.com/redhatnews>   Red Hat
<https://www.linkedin.com/company/red-hat>   Red Hat
<https://www.facebook.com/RedHatInc>

On Mon, Aug 28, 2017 at 9:11 PM, John Snow <[email protected] <mailto:[email protected]>> wrote:

On 08/27/2017 10:57 PM, Fam Zheng wrote:
> On Fri, 08/25 15:44, Max Reitz wrote:
>> Well, OK.  The main argument against supporting anything but qcow2 is >> "if you want features, use qcow2; and we are working on making qcow2 as
>> fast as possible."  I think that's a very good argument still. At some
>> point I (and probably others, too) had the idea of making qcow2 files in
>> raw layout:
>
>
> Yes! I think this idea makes a whole lot of sense, too. Metadata tables can be
> generated so old implementation can still use it.
>
> Fam
>
>> Have the data as a blob, just like a raw file, padded by >> metadata around it.  An autoclear flag would specify that the qcow2 file
>> is in this format, and if so, you could simply access it like a raw file
>> and should have exactly the same speed as a raw file.  Maybe that would
>> solve this whole issue, too?

I wonder if this would be sufficient to alleviate the desire to use raw files...

Quoted 7 lines

(Eh, well, realistically, someone's still always going to ask if they can use various features with non-qcow2 files...)

Nir, Yaniv; any input?

We are using raw format for performance reasons.

Using raw layout for the data in a qcow2 file would give you exactly the same performance as raw.

(Or better "should", but I can't think of a reason why it would not.)

Max

Quoted 21 lines

As we have many customers that currently use this format, not support it would be a blocker the use of the feature.
At a minimum we would require ability to convert raw to qcow2 raw-layout.

Please also consider that we are planning to go on the OSP route of LUN per disk and would still want the tracking to work.
I makes sense that for that and raw format you will be able to save the mapping to another file other than a qcow.

(Context: We're debating how to add persistent bitmaps to raw files as I was informed that RHV was 'asking about it.' Max is reminding me there is a proposal for a style of QCOW2 that uses a raw layout for data, mitigating or eliminating any performance hits related to the L2 cache. What I am not aware of is why RHV would use raw files for any purpose. Is it performance? Simplicity? Could RHV use a raw-layout qcow2?)

--js

#11 lore raw

YANIV LAVI (YANIV DARY)

SENIOR TECHNICAL PRODUCT MANAGER

Red Hat Israel Ltd. <https://www.redhat.com/>

34 Jerusalem Road, Building A, 1st floor

Ra'anana, Israel 4350109

[email protected] T: +972-9-7692306/8272306 F: +972-9-7692223 IM: ylavi
<https://red.ht/sig> TRIED. TESTED. TRUSTED. <https://redhat.com/trusted>
@redhatnews <https://twitter.com/redhatnews> Red Hat
<https://www.linkedin.com/company/red-hat> Red Hat
<https://www.facebook.com/RedHatInc>

Quoted 65 lines · Max Reitz
Quoted 10 lines · Yaniv Lavi (Dary)

YANIV LAVI (YANIV DARY)

SENIOR TECHNICAL PRODUCT MANAGER

Red Hat Israel Ltd. <https://www.redhat.com/>

34 Jerusalem Road, Building A, 1st floor

Quoted 7 lines

Ra'anana, Israel 4350109

[email protected] <mailto:[email protected]> T: +972-9-7692306
<tel:+972-9-7692306>/8272306 <tel:8272306> F: +972-9-7692223
<tel:+972-9-7692223> IM: ylavi

<https://red.ht/sig> TRIED. TESTED. TRUSTED. <

https://redhat.com/trusted>

Quoted 6 lines

@redhatnews <https://twitter.com/redhatnews> Red Hat
<https://www.linkedin.com/company/red-hat> Red Hat
<https://www.facebook.com/RedHatInc>

Quoted 8 lines

On Mon, Aug 28, 2017 at 9:11 PM, John Snow <[email protected] <mailto:[email protected]>> wrote:

    On 08/27/2017 10:57 PM, Fam Zheng wrote:
    > On Fri, 08/25 15:44, Max Reitz wrote:
    >> Well, OK.  The main argument against supporting anything but

qcow2 is

Quoted 24 lines
Quoted 1 line
Quoted 1 line

"if you want features, use qcow2; and we are working on making

qcow2 as
>> fast as possible." I think that's a very good argument still. At some
>> point I (and probably others, too) had the idea of making qcow2 files in
>> raw layout:
>
>
> Yes! I think this idea makes a whole lot of sense, too. Metadata tables can be
> generated so old implementation can still use it.
>
> Fam
>
>> Have the data as a blob, just like a raw file, padded by >> metadata around it. An autoclear flag would specify that the qcow2 file
>> is in this format, and if so, you could simply access it like a raw file
>> and should have exactly the same speed as a raw file. Maybe that would
>> solve this whole issue, too?

Quoted 1 line

I wonder if this would be sufficient to alleviate the desire to use

raw

Quoted 5 lines

files...

(Eh, well, realistically, someone's still always going to ask if they can use various features with non-qcow2 files...)

Quoted 8 lines
Quoted 4 lines

Nir, Yaniv; any input?

We are using raw format for performance reasons.

Using raw layout for the data in a qcow2 file would give you exactly the same performance as raw.

We had no reason to switch to anything else so far and I'm sure this option was not available when we started supporting raw format.

Quoted 33 lines

(Or better "should", but I can't think of a reason why it would not.)

Max

Quoted 4 lines

As we have many customers that currently use this format, not support it would be a blocker the use of the feature.
At a minimum we would require ability to convert raw to qcow2 raw-layout.

Quoted 8 lines

Please also consider that we are planning to go on the OSP route of LUN per disk and would still want the tracking to work.
I makes sense that for that and raw format you will be able to save the mapping to another file other than a qcow.

(Context: We're debating how to add persistent bitmaps to raw files

as I

Quoted 1 line

was informed that RHV was 'asking about it.' Max is reminding me

there

Quoted 2 lines

is a proposal for a style of QCOW2 that uses a raw layout for data, mitigating or eliminating any performance hits related to the L2

cache.

Quoted 1 line

What I am not aware of is why RHV would use raw files for any

purpose.

Quoted 5 lines

Is it performance? Simplicity? Could RHV use a raw-layout qcow2?)

--js

author
#12 lore raw
Quoted 6 lines · Yaniv Lavi (Dary)

We had no reason to switch to anything else so far and I'm sure this option was not available when we started supporting raw format.

Yeah, they don't exist yet...! I've looped you in to see if the proposal being discussed would alleviate the need for bitmaps for "other formats" if we can offer a "raw mode qcow2."

At the moment I am going to still try to add bitmaps to other formats (through the use of a qcow2 wrapper) but it sounds like a raw-layout qcow2 might provide some benefits too.

-js

#13 lore raw

YANIV LAVI (YANIV DARY)

SENIOR TECHNICAL PRODUCT MANAGER

Red Hat Israel Ltd. <https://www.redhat.com/>

34 Jerusalem Road, Building A, 1st floor

Ra'anana, Israel 4350109

[email protected] T: +972-9-7692306/8272306 F: +972-9-7692223 IM: ylavi
<https://red.ht/sig> TRIED. TESTED. TRUSTED. <https://redhat.com/trusted>
@redhatnews <https://twitter.com/redhatnews> Red Hat
<https://www.linkedin.com/company/red-hat> Red Hat
<https://www.facebook.com/RedHatInc>

Quoted 5 lines · John Snow
Quoted 2 lines · Yaniv Lavi (Dary)
Quoted 9 lines
Quoted 4 lines

We had no reason to switch to anything else so far and I'm sure this option was not available when we started supporting raw format.

Yeah, they don't exist yet...! I've looped you in to see if the proposal being discussed would alleviate the need for bitmaps for "other formats" if we can offer a "raw mode qcow2."

As we our direction is to move a file system/LUN per disk I don't think adding a new type disk image is the right priority.
The below option of separate file sound like the right direction.

Quoted 7 lines

At the moment I am going to still try to add bitmaps to other formats (through the use of a qcow2 wrapper) but it sounds like a raw-layout qcow2 might provide some benefits too.

-js

#14 lore raw
In reply to Fam Zheng

Am 28.08.2017 um 04:57 hat Fam Zheng geschrieben:

Quoted 9 lines · Max Reitz
Quoted 5 lines

Well, OK. The main argument against supporting anything but qcow2 is "if you want features, use qcow2; and we are working on making qcow2 as fast as possible." I think that's a very good argument still. At some point I (and probably others, too) had the idea of making qcow2 files in raw layout:

Yes! I think this idea makes a whole lot of sense, too. Metadata tables can be generated so old implementation can still use it.

Maybe a nice way to attack this would be "huge pages", i.e. have a L1 entry flag that tells "this points directly to a huge cluster instead of an L2 table". Gives us 512 MB clusters with a 64k cluster size, or a maximum of 512 GB clusters with a 2 MB cluster size.

Huge clusters would only be used by qemu-img create if the respective option is given, and only with preallocation.

Kevin

#15 lore raw
Quoted 11 lines · Kevin Wolf

Am 28.08.2017 um 04:57 hat Fam Zheng geschrieben:

Quoted 9 lines · Max Reitz
Quoted 5 lines

Well, OK. The main argument against supporting anything but qcow2 is "if you want features, use qcow2; and we are working on making qcow2 as fast as possible." I think that's a very good argument still. At some point I (and probably others, too) had the idea of making qcow2 files in raw layout:

Yes! I think this idea makes a whole lot of sense, too. Metadata tables can be generated so old implementation can still use it.

Quoted 7 lines

Maybe a nice way to attack this would be "huge pages", i.e. have a L1 entry flag that tells "this points directly to a huge cluster instead of an L2 table". Gives us 512 MB clusters with a 64k cluster size, or a maximum of 512 GB clusters with a 2 MB cluster size.

Huge clusters would only be used by qemu-img create if the respective option is given, and only with preallocation.

Then this image is not usable on old QEMUs, right? So this is going to be an incompatible_feature, whereas with the linear mapping L1/L2 tables approach, it can be an autoclear_feature.

Fam

#16 lore raw

Am 05.09.2017 um 15:18 hat Fam Zheng geschrieben:

Quoted 17 lines · Kevin Wolf
Quoted 16 lines

Am 28.08.2017 um 04:57 hat Fam Zheng geschrieben:

Quoted 9 lines · Max Reitz
Quoted 5 lines

Well, OK. The main argument against supporting anything but qcow2 is "if you want features, use qcow2; and we are working on making qcow2 as fast as possible." I think that's a very good argument still. At some point I (and probably others, too) had the idea of making qcow2 files in raw layout:

Yes! I think this idea makes a whole lot of sense, too. Metadata tables can be generated so old implementation can still use it.

Maybe a nice way to attack this would be "huge pages", i.e. have a L1 entry flag that tells "this points directly to a huge cluster instead of an L2 table". Gives us 512 MB clusters with a 64k cluster size, or a maximum of 512 GB clusters with a 2 MB cluster size.

Quoted 6 lines
Quoted 2 lines

Huge clusters would only be used by qemu-img create if the respective option is given, and only with preallocation.

Then this image is not usable on old QEMUs, right? So this is going to be an incompatible_feature, whereas with the linear mapping L1/L2 tables approach, it can be an autoclear_feature.

Ah yes, that's true. Maybe that's important enough that just a single global flag is better, even if it's less flexible.

Of course, this approach also means that we still need to write all of the L2 tables and use disk space for them, even though newer versions will never look at them.

Kevin

#17 lore raw
Quoted 25 lines · Kevin Wolf

Am 05.09.2017 um 15:18 hat Fam Zheng geschrieben:

Quoted 17 lines · Kevin Wolf
Quoted 16 lines

Am 28.08.2017 um 04:57 hat Fam Zheng geschrieben:

Quoted 9 lines · Max Reitz
Quoted 5 lines

Well, OK. The main argument against supporting anything but qcow2 is "if you want features, use qcow2; and we are working on making qcow2 as fast as possible." I think that's a very good argument still. At some point I (and probably others, too) had the idea of making qcow2 files in raw layout:

Yes! I think this idea makes a whole lot of sense, too. Metadata tables can be generated so old implementation can still use it.

Maybe a nice way to attack this would be "huge pages", i.e. have a L1 entry flag that tells "this points directly to a huge cluster instead of an L2 table". Gives us 512 MB clusters with a 64k cluster size, or a maximum of 512 GB clusters with a 2 MB cluster size.

Quoted 6 lines
Quoted 2 lines

Huge clusters would only be used by qemu-img create if the respective option is given, and only with preallocation.

Then this image is not usable on old QEMUs, right? So this is going to be an incompatible_feature, whereas with the linear mapping L1/L2 tables approach, it can be an autoclear_feature.

Quoted 6 lines

Ah yes, that's true. Maybe that's important enough that just a single global flag is better, even if it's less flexible.

Of course, this approach also means that we still need to write all of the L2 tables and use disk space for them, even though newer versions will never look at them.

To speculate^Wmitigate, "qemu-img create" is free to pick a larger cluster size when this feature is used?

Fam

#18 lore raw

Am 05.09.2017 um 15:39 hat Fam Zheng geschrieben:

Quoted 29 lines · Kevin Wolf
Quoted 28 lines

Am 05.09.2017 um 15:18 hat Fam Zheng geschrieben:

Quoted 17 lines · Kevin Wolf
Quoted 16 lines

Am 28.08.2017 um 04:57 hat Fam Zheng geschrieben:

Quoted 9 lines · Max Reitz
Quoted 5 lines

Well, OK. The main argument against supporting anything but qcow2 is "if you want features, use qcow2; and we are working on making qcow2 as fast as possible." I think that's a very good argument still. At some point I (and probably others, too) had the idea of making qcow2 files in raw layout:

Yes! I think this idea makes a whole lot of sense, too. Metadata tables can be generated so old implementation can still use it.

Maybe a nice way to attack this would be "huge pages", i.e. have a L1 entry flag that tells "this points directly to a huge cluster instead of an L2 table". Gives us 512 MB clusters with a 64k cluster size, or a maximum of 512 GB clusters with a 2 MB cluster size.

Quoted 6 lines
Quoted 2 lines

Huge clusters would only be used by qemu-img create if the respective option is given, and only with preallocation.

Then this image is not usable on old QEMUs, right? So this is going to be an incompatible_feature, whereas with the linear mapping L1/L2 tables approach, it can be an autoclear_feature.

Ah yes, that's true. Maybe that's important enough that just a single global flag is better, even if it's less flexible.

Quoted 6 lines
Quoted 3 lines

Of course, this approach also means that we still need to write all of the L2 tables and use disk space for them, even though newer versions will never look at them.

To speculate^Wmitigate, "qemu-img create" is free to pick a larger cluster size when this feature is used?

Seems reasonable, though the 2 MB limit for the cluster size still applies.

Kevin

author
#19 lore raw
In reply to Max Reitz
Quoted 6 lines · Max Reitz
Quoted 5 lines · John Snow

Sorry in advance for :words: ...

Quoted 2 lines · Vladimir Sementsov-Ogievskiy
Quoted 1 line · Vladimir Sementsov-Ogievskiy

22.08.2017 22:07, John Snow wrote:

[snip]

Quoted 32 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Should there be some problems with internal snapshots and other things?

I'd suspect you get exactly the same problems when using internal snapshots together with backing files. Imagine a newly created overlay file and taking a snapshot. This should give you exactly the same issue, doesn't it?

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Hm. looks like that this backing file should not only receive all reads and writes, but almost everything ->bdrv_ handlers, except bitmap related of course.

How so? Shouldn't it just work like a backing file, except it also receives writes instead of just reads?

Quoted 14 lines
Quoted 5 lines

This doesn't seems simple to implement. Especially if
imaging some not-raw feature-full format under this thin qcow2 layer.. Or we can restrict this RW backing file to be raw-only?

The idea would really be to support any arbitrary data store, so I wouldn't want to restrict it to just raw.

You're right though, this might be a kind of messy approach.

[From your other mail:]

Quoted 1 line
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

So, anyway, I see only two differences (from the outside) between this approach and just a separate bitmap-only qcow2 without a data:

It's very delicately similar, yes.

Quoted 1 line

1. in RW-backing approach qcow2-bitmap file has a link to data file (as a backing). It looks good.

And this is rather important to me.

Good to know. Some good solid opinions to work around. ;)

Quoted 38 lines
Quoted 5 lines

Right. The information necessary to establish a link between the bitmap data and the data being described is fully contained within a file fully specified by the QCOW2 spec.

Quoted 1 line

2. in RW-backing approach qcow2-bitmap file is a top of the virtual disk, in separate-file approach it is an option of the real data drive. In my opinion the second is more clean for users ("to add this feature you should use other file as your disk" vs "to add this feature you should add an option to your disk description")

I'd argue it's rather: "You cannot use this feature unless your format supports it. The only format supporting persistent bitmaps currently is qcow2. To use persistent bitmaps with other formats you can attach them as R/W backing files to an empty qcow2 file, though."

So the difference is that you are saying it's a feature that is added to a non-qcow2 image whereas I'm saying it's a feature that only a qcow2 image can provide (currently).

Quoted 17 lines

This puts us a little closer to the original idea that was rejected by Kevin at the time. To recap:

"1": Use qcow2 as a container. This was rejected because we didn't want qcow2 containing data with no semantic relationship to the qcow2 container or to each other. The way it sounds like you're proposing it, though, it would be one-qcow2-with-bitmaps-per-drive, so the data would at least stay strictly related, but it would be meaningless outside of QEMU itself. I think this is something that Kevin wanted to avoid, but I can't speak for him.

It's certainly not beyond the realm of management software to remember to correlate a qcow2 metadata file alongside its actual data stores whenever it needed to do so, but it does mean the introduction of a feature that essentially requires the use of management software, which sees resistance in the community at times.

Quoted 5 lines

In this model, you'd probably have the raw drive at the top, with the qcow2-with-bitmaps as a child node with some kind of new named child relationship. All IO stays at the root node, but the bitmap method handlers would know to look for this special bitmap-child. It shouldn't be too hard to implement.

Quoted 5 lines

I'd still like to throw in how much I dislike this approach, and I can't really think of a way to make it palatable to me. Not even "just write the file name of the image the bitmaps cover into the qcow2 file" sounds good to me, because then it still is basically unrelated data.

Understood. It's something I'd like to avoid too, but I have some real concerns about implementation of that semantic link.

Quoted 9 lines

The only approach that I might see myself liking is to indeed add a flag or whatever to say a qcow2 backing image is supposed to be R/W; and then (after somehow verifying that the qcow2 image itself is empty) just make qemu interpret this as "load the backing file as the real disk and attach the qcow2 image as a 'metadata' child" or whatever. But I fear this gets uglier and uglier because how qemu loads the files will then depend on whether the overlay is empty or not, and this may be very confusing.

Right, it makes opening a little more convoluted than it normally is.

"Oh look, it's empty and it has a RW backing file. Please stand by as we open the "RW backing file" and install it as our parent!"

It may actually not be so bad, but it does add a complexity...

Quoted 28 lines
Quoted 22 lines
Quoted 1 line

I think (may be I'm not right) loading bitmaps from additional qcow2-only-bitmaps file is simpler to implement (it will be specified in command line in drive options, like bitmaps_file=/path/to/it and then attached directly to BlockDriverState). The only drawback of simple qcow2-bitmap file is that it has not a link inside it to the data file (like backing). We can ignore it, or we can implement this link as a separate extension to qcow2.

Yes, definitely easier to implement as you say.

The hard part is going to come in defining that semantic link. At this point, the only difference between the approaches is whether or not we allow the qcow2 to point to the implementation of the data;

(1) The qcow2 is referenced by name from the CLI as an option to the other drive.

(2) The qcow2 is referenced by name on the CLI, and its backing file field intuits the location of the implementation storage.

In (1), we avoid saving or specifying the relationship between these two data stores in any way. This is certainly easy to do, and will save us some headache on the CLI. As a downside, we now have random orphaned files that aren't very interesting or useful on their own. The likelihood for desync between metadata and data increases. The use of management software is all but necessitated.

Quoted 5 lines

In (2) We have to now specify, with a dizzying long list of possibilities, the location of the implementation data. qcow2 only has a filename for backing files presently, but this is likely inadequate. What if the data store isn't a locally kept file? What if it's a socket, or a stream, or literally anything else?

Quoted 6 lines

I don't see the difference. In (1), your data image gets a "bitmap" or "metadata" child. In (2), your qcow2 image gets the usual "backing" child, or maybe call it "passthrough" or whatever, if you want to make the difference more explicit than just passing an option to the qcow2 image to pass writes to its backing file.

The difference in the relationship in-memory is actually kind of uninteresting.

The difference as I see it is primarily how we specify the relationship between the qcow2 and the implementation storage; in (1) It's defined on-disk, and in (2) It's defined via CLI only, so

(1) Incurs a cost of having to define the link syntax (possibly causing a rather qemu-specific syntax), and
(2) Avoids that cost, but leaves the data on-disk unrelated, which you hate.

Quoted 5 lines
Quoted 2 lines

We'd have to develop a new syntax for specifying these resources that can be stored in a qcow2 file,

It's called the json-pseudo-protocol and was developed exactly for this.

That's what I was hinting at for "or otherwise co-opt an existing syntax" but I was unaware that it was intended for "exactly" this.

Do we actually use it in any on-disk format, currently? qcow2 only lets you specify simple filenames in the qcow2 metadata, right?

Quoted 5 lines
Quoted 4 lines

or otherwise co-opt an existing syntax
in-use by QEMU. This syntax would likely be useful only to QEMU, which would steer the qcow2 format in a direction not too useful by other emulators, and qcow2 is an open format, so we may want to avoid this.

Quoted 7 lines

Storing a file name in the backing link field that cannot be interpreted by other programs is in my opinion still very much better than not storing any information whatsoever, because in the former case other programs can at least say "sorry, I have no idea what this means" (or maybe they can indeed interpret it, who knows), whereas in the latter they may not even know that the qcow2 image is incomplete.

I don't disagree personally, but I seem to recall that Kevin was adamant that the qcow2 bitmap extension should remain useful and semantically meaningful to third parties, so I try to keep that in mind. Maybe I should let him chime in instead of try to "concern troll" my own suggestions into the ground.

Quoted 4 lines

Also note that we are making an effort to be able to generate plain file names (such as URLs which should be usable by other programs) whenever possible.

Noted. Do we have a useful discriminator anywhere that allows us to easily check if a filename/locator/URI/whatever is in an accepted format, or if we still have QEMU-specific garbage?

We could always just disallow QEMU-specific protocol-talk from getting written and allow this only for configurations that QEMU understands to be universal...

Quoted 12 lines
Quoted 6 lines

I feel like what will make the difference between heading down either path would be helped along by answers to these questions:

- What type of data stores do we wish to support with bitmaps? Simple file-based ones, or the full spectrum of all types? Only qcow2, and to hell with people who ask for otherwise?

I don't really know how this question relates to the issue other than "If we only want to support qcow2, the whole discussion is moot; since this discussion exists, we apparently do want to support something other than qcow2 at some point."

Yeah, I mean, if the answer is a strong no here we can avoid the rest of the discussion. Worthwhile to know, right?

Quoted 44 lines

Well, OK. The main argument against supporting anything but qcow2 is "if you want features, use qcow2; and we are working on making qcow2 as fast as possible." I think that's a very good argument still. At some point I (and probably others, too) had the idea of making qcow2 files in raw layout: Have the data as a blob, just like a raw file, padded by metadata around it. An autoclear flag would specify that the qcow2 file is in this format, and if so, you could simply access it like a raw file and should have exactly the same speed as a raw file. Maybe that would solve this whole issue, too?

And as for non-file based backing files, see above.

Quoted 2 lines

- How important is it that the qcow2 remains a fully independent file capable of describing its own relationship to the data?

Technically not important. To me, very important.

Quoted 1 line

- Is it OK to allow robust, QEMU-specific data descriptors in a qcow2 file?

Depends. At least Red Hat's QA does use json file names, so there's already that.

I think QEMU-specific is OK as long as it still makes sense, as long as there is no other way, and as long as there is some kind of documentation still.

Technically, you can always put QEMU-specific stuff into the qcow2 specification and thus make it generic.

Quoted 1 line

Where I sit:

[...]

Quoted 4 lines

- I don't think Kevin will like the idea of us using qcow2 as a container that does not get treated as a first class citizen in the backing chain, but it's the easiest option to implement and avoids a lot of the syntax-of-backing-storage questions.

I'd like to throw in that I was not at all opposed to Fam's approach of having an independent format (tar, wasn't it?) just for storing bitmaps.
I know Kevin was, but I don't quite remember why. Probably because it
was a real format, but a very strange one, and then implementing it through the block layer was weird...?

Quoted 4 lines

OTOH, there is one issue I have with the R/W backing approach: Every request to the raw file has to go through the qcow2 layer. And since you probably want to use raw because of the speed, this is not so nice.

We probably could fix that by changing the relationship so that it isn't *really* a backing file, but that maybe creates other problems.

Quoted 2 lines

Max

#20 lore raw
Quoted 11 lines · John Snow
Quoted 5 lines
Quoted 2 lines

We'd have to develop a new syntax for specifying these resources that can be stored in a qcow2 file,

It's called the json-pseudo-protocol and was developed exactly for this.

That's what I was hinting at for "or otherwise co-opt an existing syntax" but I was unaware that it was intended for "exactly" this.

Do we actually use it in any on-disk format, currently? qcow2 only lets you specify simple filenames in the qcow2 metadata, right?

You can specify json-pseudo backing names both on the command line AND embedded in the qcow2 file itself (within the length limits imposed by the qcow2 header size). Yes, this means it is already possible to create qcow2 files that can only be opened by qemu (or else teaching your alternative program how to parse qemu's json-pseudo-protocol).

Quoted 14 lines
Quoted 6 lines
Quoted 5 lines

or otherwise co-opt an existing syntax
in-use by QEMU. This syntax would likely be useful only to QEMU, which would steer the qcow2 format in a direction not too useful by other emulators, and qcow2 is an open format, so we may want to avoid this.

Quoted 7 lines

Storing a file name in the backing link field that cannot be interpreted by other programs is in my opinion still very much better than not storing any information whatsoever, because in the former case other programs can at least say "sorry, I have no idea what this means" (or maybe they can indeed interpret it, who knows), whereas in the latter they may not even know that the qcow2 image is incomplete.

Quoted 5 lines

I don't disagree personally, but I seem to recall that Kevin was adamant that the qcow2 bitmap extension should remain useful and semantically meaningful to third parties, so I try to keep that in mind. Maybe I should let him chime in instead of try to "concern troll" my own suggestions into the ground.

We already have that situation today, but you are right to worry about whether making it even more prevalent is something we can try to minimize.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
author
#21 lore raw
Quoted 33 lines · Eric Blake
Quoted 11 lines · John Snow
Quoted 5 lines
Quoted 2 lines

We'd have to develop a new syntax for specifying these resources that can be stored in a qcow2 file,

It's called the json-pseudo-protocol and was developed exactly for this.

That's what I was hinting at for "or otherwise co-opt an existing syntax" but I was unaware that it was intended for "exactly" this.

Do we actually use it in any on-disk format, currently? qcow2 only lets you specify simple filenames in the qcow2 metadata, right?

You can specify json-pseudo backing names both on the command line AND embedded in the qcow2 file itself (within the length limits imposed by the qcow2 header size). Yes, this means it is already possible to create qcow2 files that can only be opened by qemu (or else teaching your alternative program how to parse qemu's json-pseudo-protocol).

Quoted 14 lines
Quoted 13 lines
Quoted 5 lines

or otherwise co-opt an existing syntax
in-use by QEMU. This syntax would likely be useful only to QEMU, which would steer the qcow2 format in a direction not too useful by other emulators, and qcow2 is an open format, so we may want to avoid this.

Storing a file name in the backing link field that cannot be interpreted by other programs is in my opinion still very much better than not storing any information whatsoever, because in the former case other programs can at least say "sorry, I have no idea what this means" (or maybe they can indeed interpret it, who knows), whereas in the latter they may not even know that the qcow2 image is incomplete.

Quoted 9 lines
Quoted 5 lines

I don't disagree personally, but I seem to recall that Kevin was adamant that the qcow2 bitmap extension should remain useful and semantically meaningful to third parties, so I try to keep that in mind. Maybe I should let him chime in instead of try to "concern troll" my own suggestions into the ground.

We already have that situation today, but you are right to worry about whether making it even more prevalent is something we can try to minimize.

Proposal distillate:

(1) Specify relationship on CLI, QCOW becomes a bitmap-child of any arbitrary node.

Pros: Easy to implement
Adds bitmap support to literally everything
Cons: Bitmap has no semantic link to data it describes
Relationship must be re-specified every launch Max and Kevin are firmly NACK

(2) Raw file becomes a R/W backing file of the QCOW2, implemented as either a bitmap-child or a more traditional backing file that can additionally service writes

Pros: Easy to understand
relationship between files exists outside of the QEMU process Adds bitmap support to just about everything that can be expressed
via JSON
Cons: All but necessitates QEMU-specific syntax in a qcow2 file
Depending on implementation, possibly messy in bdrv_open Adding bitmaps to non-qcow2 files after open makes the launch CLI
invalid for future launches (Not any different to snapshots.)

(3) Add a raw-like mapping mode to QCOW2 instead, skipping the whole affair

Pros: Adds a nice, performant hybrid mode to qcow2
Solves the problem of "bitmaps for raw" more or less Avoids bdrv_open() complications
Avoids writing qemu-specific jargon in qcow2 files
Cons: Doesn't actually add arbitrary bitmaps to any file format
Users are still gonna ask for bitmaps for other formats anyway

I think I like 2 or 3 -- or perhaps indeed two AND three. The qcow2-raw mode sounds like something we ought to have anyway. I'll try to start an RFC.

--js

#22 lore raw
Quoted 81 lines · John Snow
Quoted 33 lines · Eric Blake
Quoted 11 lines · John Snow
Quoted 5 lines
Quoted 2 lines

We'd have to develop a new syntax for specifying these resources that can be stored in a qcow2 file,

It's called the json-pseudo-protocol and was developed exactly for this.

That's what I was hinting at for "or otherwise co-opt an existing syntax" but I was unaware that it was intended for "exactly" this.

Do we actually use it in any on-disk format, currently? qcow2 only lets you specify simple filenames in the qcow2 metadata, right?

You can specify json-pseudo backing names both on the command line AND embedded in the qcow2 file itself (within the length limits imposed by the qcow2 header size). Yes, this means it is already possible to create qcow2 files that can only be opened by qemu (or else teaching your alternative program how to parse qemu's json-pseudo-protocol).

Quoted 14 lines
Quoted 13 lines
Quoted 5 lines

or otherwise co-opt an existing syntax
in-use by QEMU. This syntax would likely be useful only to QEMU, which would steer the qcow2 format in a direction not too useful by other emulators, and qcow2 is an open format, so we may want to avoid this.

Storing a file name in the backing link field that cannot be interpreted by other programs is in my opinion still very much better than not storing any information whatsoever, because in the former case other programs can at least say "sorry, I have no idea what this means" (or maybe they can indeed interpret it, who knows), whereas in the latter they may not even know that the qcow2 image is incomplete.

Quoted 9 lines
Quoted 5 lines

I don't disagree personally, but I seem to recall that Kevin was adamant that the qcow2 bitmap extension should remain useful and semantically meaningful to third parties, so I try to keep that in mind. Maybe I should let him chime in instead of try to "concern troll" my own suggestions into the ground.

We already have that situation today, but you are right to worry about whether making it even more prevalent is something we can try to minimize.

Proposal distillate:

(1) Specify relationship on CLI, QCOW becomes a bitmap-child of any arbitrary node.

Pros: Easy to implement
Adds bitmap support to literally everything
Cons: Bitmap has no semantic link to data it describes
Relationship must be re-specified every launch Max and Kevin are firmly NACK

(2) Raw file becomes a R/W backing file of the QCOW2, implemented as either a bitmap-child or a more traditional backing file that can additionally service writes

Pros: Easy to understand
relationship between files exists outside of the QEMU process Adds bitmap support to just about everything that can be expressed
via JSON
Cons: All but necessitates QEMU-specific syntax in a qcow2 file
Depending on implementation, possibly messy in bdrv_open Adding bitmaps to non-qcow2 files after open makes the launch CLI
invalid for future launches (Not any different to snapshots.)

(3) Add a raw-like mapping mode to QCOW2 instead, skipping the whole affair

Pros: Adds a nice, performant hybrid mode to qcow2
Solves the problem of "bitmaps for raw" more or less Avoids bdrv_open() complications
Avoids writing qemu-specific jargon in qcow2 files
Cons: Doesn't actually add arbitrary bitmaps to any file format
Users are still gonna ask for bitmaps for other formats anyway

Quoted 3 lines

I think I like 2 or 3 -- or perhaps indeed two AND three. The qcow2-raw mode sounds like something we ought to have anyway. I'll try to start an RFC.

I think the only main thing that's missing for implementing (3) is a way to mark allocated clusters to be fall-through-to-backing-file.

Max

#23 lore raw
In reply to John Snow
Quoted 4 lines · John Snow
Quoted 1 line · Max Reitz

On 2017-08-25 02:55, John Snow wrote:

[...]

Quoted 23 lines
Quoted 13 lines
Quoted 7 lines

In (1), we avoid saving or specifying the relationship between these two data stores in any way. This is certainly easy to do, and will save us some headache on the CLI. As a downside, we now have random orphaned files that aren't very interesting or useful on their own. The likelihood for desync between metadata and data increases. The use of management software is all but necessitated.

Quoted 5 lines

In (2) We have to now specify, with a dizzying long list of possibilities, the location of the implementation data. qcow2 only has a filename for backing files presently, but this is likely inadequate. What if the data store isn't a locally kept file? What if it's a socket, or a stream, or literally anything else?

Quoted 6 lines

I don't see the difference. In (1), your data image gets a "bitmap" or "metadata" child. In (2), your qcow2 image gets the usual "backing" child, or maybe call it "passthrough" or whatever, if you want to make the difference more explicit than just passing an option to the qcow2 image to pass writes to its backing file.

The difference in the relationship in-memory is actually kind of uninteresting.

Quoted 7 lines

The difference as I see it is primarily how we specify the relationship between the qcow2 and the implementation storage; in (1) It's defined on-disk, and in (2) It's defined via CLI only, so

(1) Incurs a cost of having to define the link syntax (possibly causing a rather qemu-specific syntax), and
(2) Avoids that cost, but leaves the data on-disk unrelated, which you hate.

What I meant was that in the end both have some parent-child relationship in the BDS graph, so you can freely define both on the CLI. So for (1), it usually is defined on-disk, yes, but you can also define it on the command line -- just like it works for backing files.

Quoted 11 lines
Quoted 5 lines
Quoted 2 lines

We'd have to develop a new syntax for specifying these resources that can be stored in a qcow2 file,

It's called the json-pseudo-protocol and was developed exactly for this.

That's what I was hinting at for "or otherwise co-opt an existing syntax" but I was unaware that it was intended for "exactly" this.

Do we actually use it in any on-disk format, currently? qcow2 only lets you specify simple filenames in the qcow2 metadata, right?

I don't think it's specified. And I'm pretty sure that people would agree that e.g. HTTP URLs are fine to specify in the backing link field.
So I think that non-simple filenames are fine, too, but the question of
course is where to draw the line.

I'd argue that every time your start to allow filenames to have protocols, you end up with some that not all programs can interpret; like the json: protocol.

Quoted 13 lines
Quoted 5 lines
Quoted 4 lines

or otherwise co-opt an existing syntax
in-use by QEMU. This syntax would likely be useful only to QEMU, which would steer the qcow2 format in a direction not too useful by other emulators, and qcow2 is an open format, so we may want to avoid this.

Quoted 7 lines

Storing a file name in the backing link field that cannot be interpreted by other programs is in my opinion still very much better than not storing any information whatsoever, because in the former case other programs can at least say "sorry, I have no idea what this means" (or maybe they can indeed interpret it, who knows), whereas in the latter they may not even know that the qcow2 image is incomplete.

Quoted 5 lines

I don't disagree personally, but I seem to recall that Kevin was adamant that the qcow2 bitmap extension should remain useful and semantically meaningful to third parties, so I try to keep that in mind. Maybe I should let him chime in instead of try to "concern troll" my own suggestions into the ground.

I seem to recall that I was adamant, too. :-)

All I'm saying is if you allow qcow2 to have writable backing files, it doesn't make it any less meaningful to 3rd party programs than the backing link field currently is.

Quoted 8 lines
Quoted 4 lines

Also note that we are making an effort to be able to generate plain file names (such as URLs which should be usable by other programs) whenever possible.

Noted. Do we have a useful discriminator anywhere that allows us to easily check if a filename/locator/URI/whatever is in an accepted format, or if we still have QEMU-specific garbage?

Are NBD URLs qemu-specific? :-)

I think protocol URLs are just always icky. If it's json: (when bs->exact_filename is empty), you can be sure it's qemu-specific -- otherwise, it may be.

Quoted 3 lines

We could always just disallow QEMU-specific protocol-talk from getting written and allow this only for configurations that QEMU understands to be universal...

I'd say it's too late for that, and also that json: was introduced precisely to be able to get full BDS graph configuration into a backing filename field.

[...]

Quoted 7 lines
Quoted 4 lines

OTOH, there is one issue I have with the R/W backing approach: Every request to the raw file has to go through the qcow2 layer. And since you probably want to use raw because of the speed, this is not so nice.

We probably could fix that by changing the relationship so that it isn't *really* a backing file, but that maybe creates other problems.

Yes. This will be reflected in the BDS graph relationship, and it's just weird that sometimes a qcow2 backing file would be loaded as its parent.

Max

#24 lore raw
In reply to John Snow

On 2017-08-22 21:07, John Snow wrote:

[...]

Quoted 19 lines

(3) Add either a new flag that turns qcow2's backing file into a full R/W backing file, or add a new extension to qcow2 entirely (bypassing the traditional backing file mechanism to avoid confusion for older tooling) that adds a new read-write backing file field.

This RW backing file field will be used for all reads AND writes; the qcow2 in question becomes a metadata container on top of the BDS chain. We can re-use Vladimir's bitmap persistence extension to save bitmaps in a qcow2 shell.

The qcow2 becomes effectively a metadata cache for a new (essentially) filter node that handles features such as bitmaps. This could also be used to provide allocation map data for RAW files and other goodies down the road.

Hopefully this achieves our desire to not create new formats AND our desire to concentrate features (and debugging, testing, etc) into qcow2, while allowing users to "have bitmaps with raw files."

Quoted 7 lines

Of course, in this scenario, users now have two files: a qcow2 wrapper and the actual raw file in question; but regardless of how we were going to solve this, a raw file necessitates an external file of some sort, else we give up the idea that it was a raw file.

Sound good?

While I don't quite like the idea of R/W backing files, I guess "don't quite like" is still rather good.

I like how this idea would allow us to use the existing code without putting just arbitrary binary data into the qcow2 file; the data still relates to the virtual disk represented by the qcow2 image.

So design-wise, I don't think I have any complaints.

As for Kevin, he's on PTO, though. ;-)

Max

author
#25 lore raw
Quoted 29 lines · Max Reitz

On 2017-08-22 21:07, John Snow wrote:

[...]

Quoted 25 lines

(3) Add either a new flag that turns qcow2's backing file into a full R/W backing file, or add a new extension to qcow2 entirely (bypassing the traditional backing file mechanism to avoid confusion for older tooling) that adds a new read-write backing file field.

This RW backing file field will be used for all reads AND writes; the qcow2 in question becomes a metadata container on top of the BDS chain. We can re-use Vladimir's bitmap persistence extension to save bitmaps in a qcow2 shell.

The qcow2 becomes effectively a metadata cache for a new (essentially) filter node that handles features such as bitmaps. This could also be used to provide allocation map data for RAW files and other goodies down the road.

Hopefully this achieves our desire to not create new formats AND our desire to concentrate features (and debugging, testing, etc) into qcow2, while allowing users to "have bitmaps with raw files."

Of course, in this scenario, users now have two files: a qcow2 wrapper and the actual raw file in question; but regardless of how we were going to solve this, a raw file necessitates an external file of some sort, else we give up the idea that it was a raw file.

Quoted 5 lines
Quoted 1 line

Sound good?

While I don't quite like the idea of R/W backing files, I guess "don't quite like" is still rather good.

Yeah, it's not necessarily my first pick, but it might be the least bad. If you have any suggestions or alternatives for a way to accomplish the same in a way that does not leave any, even faint, bad taste in your mouth you are more than welcome to suggest it.

Quoted 10 lines

I like how this idea would allow us to use the existing code without putting just arbitrary binary data into the qcow2 file; the data still relates to the virtual disk represented by the qcow2 image.

So design-wise, I don't think I have any complaints.

As for Kevin, he's on PTO, though. ;-)

Max

Ah, right. Well... I'll just have to have something fun for him to look at.

#26 lore raw

Am 23.08.2017 um 19:44 hat John Snow geschrieben:

Quoted 30 lines · Max Reitz
Quoted 29 lines · John Snow

[...]

Quoted 25 lines

(3) Add either a new flag that turns qcow2's backing file into a full R/W backing file, or add a new extension to qcow2 entirely (bypassing the traditional backing file mechanism to avoid confusion for older tooling) that adds a new read-write backing file field.

This RW backing file field will be used for all reads AND writes; the qcow2 in question becomes a metadata container on top of the BDS chain. We can re-use Vladimir's bitmap persistence extension to save bitmaps in a qcow2 shell.

The qcow2 becomes effectively a metadata cache for a new (essentially) filter node that handles features such as bitmaps. This could also be used to provide allocation map data for RAW files and other goodies down the road.

Hopefully this achieves our desire to not create new formats AND our desire to concentrate features (and debugging, testing, etc) into qcow2, while allowing users to "have bitmaps with raw files."

Of course, in this scenario, users now have two files: a qcow2 wrapper and the actual raw file in question; but regardless of how we were going to solve this, a raw file necessitates an external file of some sort, else we give up the idea that it was a raw file.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Sound good?

While I don't quite like the idea of R/W backing files, I guess "don't quite like" is still rather good.

Yeah, it's not necessarily my first pick, but it might be the least bad.

As for backing files always being read-only, that ship has sailed long ago. We really never had it because I think HMP 'commit' was introduced at the same time as backing files, but at least it was still contained in synchronous function protected by the BQL. But at latest since we introduced live block jobs, it's not a reasonable assumption to make any more.

At this point, I have no problems with adding more users of writable backing files any more. We'll have to use op blockers to make it safe.

Quoted 3 lines

If you have any suggestions or alternatives for a way to accomplish the same in a way that does not leave any, even faint, bad taste in your mouth you are more than welcome to suggest it.

Maybe one thing that I don't want to dismiss right away would be a separate BlockDriver for passthrough qcow2 images so that we don't clutter all functions with special cases. But I'm not compeltely convinced of it either.

I think I once had a use case for clusters that are marked as "read/write to backing file", but I can't seem to remember it now. If we had such a per-cluster setting, then a separate BlockDriver wouldn't be an option, obviously.

Kevin

#27 lore raw
In reply to John Snow
Quoted 15 lines · John Snow

(3) Add either a new flag that turns qcow2's backing file into a full R/W backing file, or add a new extension to qcow2 entirely (bypassing the traditional backing file mechanism to avoid confusion for older tooling) that adds a new read-write backing file field.

This RW backing file field will be used for all reads AND writes; the qcow2 in question becomes a metadata container on top of the BDS chain. We can re-use Vladimir's bitmap persistence extension to save bitmaps in a qcow2 shell.

The qcow2 becomes effectively a metadata cache for a new (essentially) filter node that handles features such as bitmaps. This could also be used to provide allocation map data for RAW files and other goodies down the road.

Quoted 8 lines

Hopefully this achieves our desire to not create new formats AND our desire to concentrate features (and debugging, testing, etc) into qcow2, while allowing users to "have bitmaps with raw files."

Of course, in this scenario, users now have two files: a qcow2 wrapper and the actual raw file in question; but regardless of how we were going to solve this, a raw file necessitates an external file of some sort, else we give up the idea that it was a raw file.

There is some complexity here for management tools:

If the underlying image is resized, who resizes the qcow2 and how do they know to do it?

If QEMU's resize/truncate command it used, does first try to resize the underlying image and then resize the qcow2? This is probably the sanest approach.

If the underlying image is moved to a new location, does the qcow2 file need to be modified and who does that?

Management tools need to figure out how to represent manage this extra qcow2 file. The easiest solution is to punt it to the user and treat it as part of a backing file chain. If the management tool wants to automatically manage the qcow2 so the user just specifies the underlying image and enables the persistent bitmap checkbox, then it becomes more complicated.

Stefan

#28 lore raw
Quoted 37 lines · Stefan Hajnoczi
Quoted 15 lines · John Snow

(3) Add either a new flag that turns qcow2's backing file into a full R/W backing file, or add a new extension to qcow2 entirely (bypassing the traditional backing file mechanism to avoid confusion for older tooling) that adds a new read-write backing file field.

This RW backing file field will be used for all reads AND writes; the qcow2 in question becomes a metadata container on top of the BDS chain. We can re-use Vladimir's bitmap persistence extension to save bitmaps in a qcow2 shell.

The qcow2 becomes effectively a metadata cache for a new (essentially) filter node that handles features such as bitmaps. This could also be used to provide allocation map data for RAW files and other goodies down the road.

Quoted 8 lines

Hopefully this achieves our desire to not create new formats AND our desire to concentrate features (and debugging, testing, etc) into qcow2, while allowing users to "have bitmaps with raw files."

Of course, in this scenario, users now have two files: a qcow2 wrapper and the actual raw file in question; but regardless of how we were going to solve this, a raw file necessitates an external file of some sort, else we give up the idea that it was a raw file.

There is some complexity here for management tools:

If the underlying image is resized, who resizes the qcow2 and how do they know to do it?

If QEMU's resize/truncate command it used, does first try to resize the underlying image and then resize the qcow2? This is probably the sanest approach.

If the underlying image is moved to a new location, does the qcow2 file need to be modified and who does that?

Quoted 6 lines

Management tools need to figure out how to represent manage this extra qcow2 file. The easiest solution is to punt it to the user and treat it as part of a backing file chain. If the management tool wants to automatically manage the qcow2 so the user just specifies the underlying image and enables the persistent bitmap checkbox, then it becomes more complicated.

Indeed, I don't think it is practical to have libvirt / QEMU automagically create a qcow2 overlay on disk. Something has to decide where this would be stored. You might say just put it alongside the raw file, but it might not be a local file at all, it could be a NBD, or RBD raw "file". So do we create local qcow2 file, or store a qcow2 file inside another RBD volume to hold the persistent bitmap. This kind of decision needs to be made by the mgmt app since only it knows about its storage mgmt model. At this point you might as well just let the mgmt app take care of it all and not try to do anything magical with qcow2 overlays in libvirt/QEMU

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
author
#29 lore raw
Quoted 45 lines · Daniel P. Berrange
Quoted 37 lines · Stefan Hajnoczi
Quoted 15 lines · John Snow

(3) Add either a new flag that turns qcow2's backing file into a full R/W backing file, or add a new extension to qcow2 entirely (bypassing the traditional backing file mechanism to avoid confusion for older tooling) that adds a new read-write backing file field.

This RW backing file field will be used for all reads AND writes; the qcow2 in question becomes a metadata container on top of the BDS chain. We can re-use Vladimir's bitmap persistence extension to save bitmaps in a qcow2 shell.

The qcow2 becomes effectively a metadata cache for a new (essentially) filter node that handles features such as bitmaps. This could also be used to provide allocation map data for RAW files and other goodies down the road.

Quoted 8 lines

Hopefully this achieves our desire to not create new formats AND our desire to concentrate features (and debugging, testing, etc) into qcow2, while allowing users to "have bitmaps with raw files."

Of course, in this scenario, users now have two files: a qcow2 wrapper and the actual raw file in question; but regardless of how we were going to solve this, a raw file necessitates an external file of some sort, else we give up the idea that it was a raw file.

There is some complexity here for management tools:

If the underlying image is resized, who resizes the qcow2 and how do they know to do it?

If QEMU's resize/truncate command it used, does first try to resize the underlying image and then resize the qcow2? This is probably the sanest approach.

If the underlying image is moved to a new location, does the qcow2 file need to be modified and who does that?

Quoted 6 lines

Management tools need to figure out how to represent manage this extra qcow2 file. The easiest solution is to punt it to the user and treat it as part of a backing file chain. If the management tool wants to automatically manage the qcow2 so the user just specifies the underlying image and enables the persistent bitmap checkbox, then it becomes more complicated.

Quoted 7 lines

Indeed, I don't think it is practical to have libvirt / QEMU automagically create a qcow2 overlay on disk. Something has to decide where this would be stored. You might say just put it alongside the raw file, but it might not be a local file at all, it could be a NBD, or RBD raw "file". So do we create local qcow2 file, or store a qcow2 file inside another RBD volume to hold the persistent bitmap. This kind of decision needs to be made by the mgmt app since only it knows about its storage mgmt model.

Oh, you mean to say mgmt app like VMM or something even above libvirt, yes? Who currently makes the decision for where snapshot files and the like goes, does libvirt not decide that, but the app using it?

Quoted 3 lines

At this point you might as well just let the mgmt app take care of it all and not try to do anything magical with qcow2 overlays in libvirt/QEMU

Might be the sanest, yes -- but say I don't offer an "automagic" way to add a bitmap to a raw file to a running QEMU instance but rather offer a way to qcow2ify an existing node:

We could create a wrapper:

qemu-img create -f qcow2 -o wrapper wrapper.qcow2

Then add a node:

blockdev_add driver=qcow2 node-name=foo file.driver=file file.filename=wrapper.qcow2

(The size of the drive could perhaps remain as zero temporarily here)

Then some magic to make it the active target of whatever blockbackend was using the old image, perhaps?:

blockdev_magic target=virtioblk0 node-name=foo

At this point, virtioblk0 is now backed by our new magic qcow2 node which provides bitmap features for whatever kind of backing storage virtioblk0 had, and nothing automagic happened -- we passed explicit file references.

Any magic that we wish to provide can happen in libvirt or above.

--js

#30 lore raw
In reply to John Snow

Am 22.08.2017 um 21:07 hat John Snow geschrieben:

Quoted 5 lines

Well, we knew we'd want this sooner or later. I've got some pings downstream over whether or not we support persistent bitmaps for non-qcow2 formats.

Currently: no, we don't.

I was going to write some things about r/w backing file, and I might still do that later, but for now, let me take a step back:

What is the use case here?

Using a specific image format is not a value in and of itself; it should be chosen depending on which features you need. What prevents those downstream users from simply choosing qcow2 for their data, too?

Kevin

#31 lore raw
Quoted 11 lines · Kevin Wolf

Am 22.08.2017 um 21:07 hat John Snow geschrieben:

Quoted 5 lines

Well, we knew we'd want this sooner or later. I've got some pings downstream over whether or not we support persistent bitmaps for non-qcow2 formats.

Currently: no, we don't.

I was going to write some things about r/w backing file, and I might still do that later, but for now, let me take a step back:

What is the use case here?

A user has 100s or 1000s of disk images over iSCSI. They would like to use the new incremental backup feature. Converting all existing disk images to qcow2 is not an option because it would be too invasive.

Stefan