Skip to contentSkip to conversation

storing machine data in qcow images?

Qemu-devel Michael S. Tsirkin 17 participants 157 messages May 18, 2018 – Jun 11, 2018 Page 1 of 2

lore
Share & tools
lore
#0 lore raw

Hi!
Right now, QEMU supports multiple machine types within a given architecture. This was the case for many architectures (like ARM) for a while, somewhat more recently this is the case for x86 with I440FX and Q35 options.

Unfortunately this means that it's no longer possible to more or less reliably boot a VM just given a disk image, even if you select the correct QEMU binary:
you must supply the correct machine type.

Some guests go even further and require specific devices to be present.

Would it be reasonable to support storing this information in the qcow image itself? For example, I can see it following immediately the backing file path within the image.

As Eduardo pointed out off-list, the format could be a set of key-value pairs. Initially qemu-img could gain ability to retrieve and manipulate these. Down the road we could teach qemu to use them automatically. We could also thinkably warn the user, or drop the image from the boot order.

Reasonable (IMO) things we could store in such a section:
- qemu architecture to use with the image
- machine type

more possibilities:
- required cpu flags
- expected frontend devices
- kernel flags for device tree based guests

Security considerations
- If there is a machine type specific security issue, this makes it easier to trick user to hitting it. Not sure how common this is.
- We most likely shouldn't get backend parameters from the image

Thoughts?

Signature · 1 line
MST
#1 lore raw
Quoted 17 lines · Michael S. Tsirkin

Hi!
Right now, QEMU supports multiple machine types within a given architecture. This was the case for many architectures (like ARM) for a while, somewhat more recently this is the case for x86 with I440FX and Q35 options.

Unfortunately this means that it's no longer possible to more or less reliably boot a VM just given a disk image, even if you select the correct QEMU binary:
you must supply the correct machine type.

Some guests go even further and require specific devices to be present.

Would it be reasonable to support storing this information in the qcow image itself? For example, I can see it following immediately the backing file path within the image.

Quoted 5 lines

As Eduardo pointed out off-list, the format could be a set of key-value pairs. Initially qemu-img could gain ability to retrieve and manipulate these. Down the road we could teach qemu to use them automatically. We could also thinkably warn the user, or drop the image from the boot order.

Some additional context:

Currently OpenStack and other management stacks support importing "guest images", that are often just qcow2 disk images. Today all management stacks suppose x86 guest images all work using pc-i440fx, but this is likely to change with newer guest OS versions.

Right now it's very convenient for users to simply create disk images using whatever VM management tools they have (e.g. virt-image, virt-install, virsh) to install and configure a guest, and all they need to do is to upload the resulting disk image.

If information about the machine-type and disk type used to create the VM is saved in the disk image, OpenStack and other management stacks can use this information as hints to choose the right machine-type for a given guest image. This would also help the system detect mistakes like using an image for the wrong architecture.

I don't think QEMU needs to use this information automatically, necessarily. I think the first step is to simply make QEMU save this information in the disk image, and making qemu-img able to read and write this information.

Quoted 4 lines

Reasonable (IMO) things we could store in such a section:
- qemu architecture to use with the image
- machine type

Maybe just the machine-type family would be enough?

Quoted 5 lines

more possibilities:
- required cpu flags
- expected frontend devices
- kernel flags for device tree based guests

All these might be useful in some cases. I think it's important to highlight that these would be just hints for systems importing the disk image, and not mandatory.

Quoted 5 lines

Security considerations
- If there is a machine type specific security issue, this makes it easier to trick user to hitting it. Not sure how common this is.

Yeah, we need to keep this in mind for every hint we add to this system.

I would prefer a system with a very limited set of possible input values, to avoid transforming this into a new attack vector.

For example, I think the hint needs to specify: only the machine-type family instead of the full machine-type version; only expected NIC model instead of NIC model + mac address + PCI address; only the CPU architecture instead of CPU model name + flags.

(But "guest kernel flags" seems acceptable, because it's parsed only by guest code.)

If any management stack requires a more detailed VM description, they won't be covered by this system, and they can't expect qcow2 disk images to carry all the information they need.

Quoted 1 line

- We most likely shouldn't get backend parameters from the image

Agreed.

Signature · 1 line
Eduardo
#2 lore raw
In reply to Michael S. Tsirkin
Quoted 10 lines · Michael S. Tsirkin

Hi!
Right now, QEMU supports multiple machine types within a given architecture. This was the case for many architectures (like ARM) for a while, somewhat more recently this is the case for x86 with I440FX and Q35 options.

Unfortunately this means that it's no longer possible to more or less reliably boot a VM just given a disk image, even if you select the correct QEMU binary:
you must supply the correct machine type.

You must /sometimes/ supply the correct machine type.

It is quite dependent on the guest OS you have installed, and even just how the guest OS is configured. In general Linux is very flexible and can adapt to a wide range of hardware, automatically detecting things as needed. It is possible for a sysadmin to build a Linux image in a way that would only work with I440FX, but I don't think it would be common to see that. Many distros build and distribute disk images that can work across VMWare, KVM, and VirtualBox which all have very quite different hardware. Non-x86 archs may be more fussy but I don't have personal experiance with them

Windows is probably where things get more tricky, as it is not happy with disks moving between different controller types for example, and you might trigger license activation again.

Quoted 5 lines

Some guests go even further and require specific devices to be present.

Would it be reasonable to support storing this information in the qcow image itself? For example, I can see it following immediately the backing file path within the image.

The backing file string needs to go in space between the end of headers and start of first cluster, and the spec explicitly says nothing else must be stored there. Also we can already hit the length limit on the backing file.

There would need to be an explicit header extension defined with its own clusters allocated instead.

That said I'm not really convinced that using the qcow2 headers is a good plan. We have many disk image formats in common use, qcow2 is just one. Even if the user provides the image in qcow2 format, that doesn't mean that mgmt apps actually store the qcow2 file.

For example in some deployments OpenStack will immediately convert the image to raw for storage in an RBD volume as it is uploaded to Glance. So the glance image store would need to have a way to extract & save the info at time of upload. OpenStack targets multiple hypervisors though, so I'm not sure they would welcome something that is specific to just qcow2 in this area.

The closest to a cross-hypervisor standard is OVF which can store metadata about required hardware for a VM. I'm pretty sure it does not have the concept of machine types, but maybe it has a way for people to define metadata extensions. Since it is just XML at the end of the day, even if there was nothing official in OVF, it would be possible to just define a custom XML namespace and declare a schema for that to follow.

Quoted 9 lines

As Eduardo pointed out off-list, the format could be a set of key-value pairs. Initially qemu-img could gain ability to retrieve and manipulate these. Down the road we could teach qemu to use them automatically. We could also thinkably warn the user, or drop the image from the boot order.

Reasonable (IMO) things we could store in such a section:
- qemu architecture to use with the image
- machine type

A concern is about what you actually put here. We could easily create a situation where we make images /less/ portable. eg take a Linux image which is capable of running on both i440fx and q35, if that was built on i44fx and that gets recorded, a mgmt app which honours this info is needless restricting how the image can be run.

Or consider that LTS distros typically create custom machine types, so you can have a image with machine type pc-rhel-7.4.0 which is now unable to be used on an Ubuntu distro which lacks the RHEL machine types.

IOW, there's a distinction between what's recommended, vs what's required, vs what's forbidden. Whitelisting valid machine types is too restrictive, but blacklisting is not broad enough.

Quoted 2 lines

more possibilities:
- required cpu flags

Again this is not so black & white - there's a distinction between what is absolutely required vs what is merely recommended

Quoted 7 lines

- expected frontend devices
- kernel flags for device tree based guests

Security considerations
- If there is a machine type specific security issue, this makes it easier to trick user to hitting it. Not sure how common this is.

This would imply setting very specific versioned machine type choice, but that kills any kind of platform portability.

Quoted 3 lines

- We most likely shouldn't get backend parameters from the image

Thoughts?

I tend to think we'd be better looking at what we can do in the context of an existing standard like OVF rather than inventing something that only works with qcow2. I think it would need to be more expressive than just a single list of key,value pairs for each item.

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 :|
#3 lore raw
Quoted 25 lines · Daniel P. Berrangé
Quoted 10 lines · Michael S. Tsirkin

Hi!
Right now, QEMU supports multiple machine types within a given architecture. This was the case for many architectures (like ARM) for a while, somewhat more recently this is the case for x86 with I440FX and Q35 options.

Unfortunately this means that it's no longer possible to more or less reliably boot a VM just given a disk image, even if you select the correct QEMU binary:
you must supply the correct machine type.

You must /sometimes/ supply the correct machine type.

It is quite dependent on the guest OS you have installed, and even just how the guest OS is configured. In general Linux is very flexible and can adapt to a wide range of hardware, automatically detecting things as needed. It is possible for a sysadmin to build a Linux image in a way that would only work with I440FX, but I don't think it would be common to see that. Many distros build and distribute disk images that can work across VMWare, KVM, and VirtualBox which all have very quite different hardware. Non-x86 archs may be more fussy but I don't have personal experiance with them

Quoted 3 lines

Windows is probably where things get more tricky, as it is not happy with disks moving between different controller types for example, and you might trigger license activation again.

All I'm suggesting here is just adding extra hints that OpenStack can use.

I have very specific goal here: the goal is to make it less painful to users when OpenStack+libvirt+QEMU switch to using a different machine-type by default (q35), and/or when guest OSes stop supporting pc-i440fx. I assume this is a goal for OpenStack as well.

We can make the solution to be more extensible and solve other problems as well, but my original goal is the one above.

Quoted 8 lines
Quoted 7 lines

Some guests go even further and require specific devices to be present.

Would it be reasonable to support storing this information in the qcow image itself? For example, I can see it following immediately the backing file path within the image.

Quoted 7 lines

The backing file string needs to go in space between the end of headers and start of first cluster, and the spec explicitly says nothing else must be stored there. Also we can already hit the length limit on the backing file.

There would need to be an explicit header extension defined with its own clusters allocated instead.

This sounds correct.

Quoted 6 lines

That said I'm not really convinced that using the qcow2 headers is a good plan. We have many disk image formats in common use, qcow2 is just one. Even if the user provides the image in qcow2 format, that doesn't mean that mgmt apps actually store the qcow2 file.

Why this OpenStack implementation detail matters? Once the hints are included in the input, it's up to OpenStack to choose how to deal with it.

Quoted 7 lines

For example in some deployments OpenStack will immediately convert the image to raw for storage in an RBD volume as it is uploaded to Glance. So the glance image store would need to have a way to extract & save the info at time of upload. OpenStack targets multiple hypervisors though, so I'm not sure they would welcome something that is specific to just qcow2 in this area.

I don't get the "something that is specific to just qcow2" part. Adding extra info to qcow2 doesn't prevent other file formats from carrying the same information as well.

Quoted 7 lines

The closest to a cross-hypervisor standard is OVF which can store metadata about required hardware for a VM. I'm pretty sure it does not have the concept of machine types, but maybe it has a way for people to define metadata extensions. Since it is just XML at the end of the day, even if there was nothing official in OVF, it would be possible to just define a custom XML namespace and declare a schema for that to follow.

There's nothing preventing OVF from supporting the same kind of hints.

I just don't think we should require people to migrate to OVF if all they need is to tell OpenStack what's the recommended machine-type for a guest image.

Requiring a different image format seems very likely to not fulfill the goal I stated above: it will require using different tools to create the guest images, and we can't force everybody publishing guest images to stop using qcow2.

Quoted 12 lines
Quoted 11 lines

As Eduardo pointed out off-list, the format could be a set of key-value pairs. Initially qemu-img could gain ability to retrieve and manipulate these. Down the road we could teach qemu to use them automatically. We could also thinkably warn the user, or drop the image from the boot order.

Reasonable (IMO) things we could store in such a section:
- qemu architecture to use with the image
- machine type

Quoted 5 lines

A concern is about what you actually put here. We could easily create a situation where we make images /less/ portable. eg take a Linux image which is capable of running on both i440fx and q35, if that was built on i44fx and that gets recorded, a mgmt app which honours this info is needless restricting how the image can be run.

That's why it should be just a hint, not a requirement.

Quoted 5 lines

Or consider that LTS distros typically create custom machine types, so you can have a image with machine type pc-rhel-7.4.0 which is now unable to be used on an Ubuntu distro which lacks the RHEL machine types.

That's why recording the machine-type family is more useful than recording the full versioned machine-type name.

Quoted 14 lines

IOW, there's a distinction between what's recommended, vs what's required, vs what's forbidden. Whitelisting valid machine types is too restrictive, but blacklisting is not broad enough.

Quoted 2 lines

more possibilities:
- required cpu flags

Again this is not so black & white - there's a distinction between what is absolutely required vs what is merely recommended

Quoted 3 lines

- expected frontend devices
- kernel flags for device tree based guests

Quoted 7 lines
Quoted 4 lines

Security considerations
- If there is a machine type specific security issue, this makes it easier to trick user to hitting it. Not sure how common this is.

This would imply setting very specific versioned machine type choice, but that kills any kind of platform portability.

True.

Quoted 9 lines
Quoted 4 lines

- We most likely shouldn't get backend parameters from the image

Thoughts?

I tend to think we'd be better looking at what we can do in the context of an existing standard like OVF rather than inventing something that only works with qcow2. I think it would need to be more expressive than just a single list of key,value pairs for each item.

Why you claim we are inventing something that only works with qcow2?

About being more expressive than just a single list of key,value pairs, I don't see any evidence of that being necessary for the problems we're trying to address.

Signature · 1 line
Eduardo
#4 lore raw

Eduardo Habkost <[email protected]> writes:

[...]

Quoted 3 lines

About being more expressive than just a single list of key,value pairs, I don't see any evidence of that being necessary for the problems we're trying to address.

Short history of a configuration format you might have encountered:

1. A couple of (key, value) is all we ne need for the problems we're trying to address. (v0.4, 2003)

2.1. I got this one special snowflake problem where I actually need a few related values. Fortunately, this little ad hoc parser can take apart the key's single value easily. (ca. v0.8, 2005)

...

2.n. Snowflakes are surprisingly common, but fortunately one more little ad hoc parser can't hurt.

3. Umm, this is getting messy. Let's have proper infrastructure for two-level keys. Surely two levels are all we ne need for the problems we're trying to address. Fortunately, we can bolt them on without too much trouble. (v0.12, 2009)

4. Err, trees, I'm afraid we actually need trees. Fortunately, we can hack them into the existing two-level infrastructure without too much trouble. (v1.3, 2013)

5. You are in a maze of twisting little passages, all different. (today)

How confident are we a single list of (key, value) is really all we're going to need?

Even if we think it is, would it be possible to provide for a future extension to trees at next to no cost?

#5 lore raw
Quoted 34 lines · Markus Armbruster

Eduardo Habkost <[email protected]> writes:

[...]

Quoted 3 lines

About being more expressive than just a single list of key,value pairs, I don't see any evidence of that being necessary for the problems we're trying to address.

Short history of a configuration format you might have encountered:

1. A couple of (key, value) is all we ne need for the problems we're trying to address. (v0.4, 2003)

2.1. I got this one special snowflake problem where I actually need a few related values. Fortunately, this little ad hoc parser can take apart the key's single value easily. (ca. v0.8, 2005)

...

2.n. Snowflakes are surprisingly common, but fortunately one more little ad hoc parser can't hurt.

3. Umm, this is getting messy. Let's have proper infrastructure for two-level keys. Surely two levels are all we ne need for the problems we're trying to address. Fortunately, we can bolt them on without too much trouble. (v0.12, 2009)

4. Err, trees, I'm afraid we actually need trees. Fortunately, we can hack them into the existing two-level infrastructure without too much trouble. (v1.3, 2013)

5. You are in a maze of twisting little passages, all different. (today)

Quoted 5 lines

How confident are we a single list of (key, value) is really all we're going to need?

Even if we think it is, would it be possible to provide for a future extension to trees at next to no cost?

I'm confident that a list of key,values is all we need for the current problem.

I also agree that being possible to represent trees is a good idea, and it would probably have next to no cost.

But I disagree if the point here is "we will eventually need much more complex data in the future, so let's require users to move to OVF instead".

The point here is to allow users to simply copy an existing disk image, and it will contain enough hints for a cloud stack to choose reasonable defaults for machine-type and disk type automatically. Requiring the user to perform a separate step to encapsulate the disk image in another file format defeats the whole purpose of the proposal.

Signature · 1 line
Eduardo
#6 lore raw
Quoted 9 lines · Eduardo Habkost
Quoted 8 lines · Markus Armbruster

Eduardo Habkost <[email protected]> writes:

[...]

Quoted 3 lines

About being more expressive than just a single list of key,value pairs, I don't see any evidence of that being necessary for the problems we're trying to address.

Short history of a configuration format you might have encountered:

[snip]

Quoted 8 lines
Quoted 5 lines

How confident are we a single list of (key, value) is really all we're going to need?

Even if we think it is, would it be possible to provide for a future extension to trees at next to no cost?

I'm confident that a list of key,values is all we need for the current problem.

I'm not convinced. A disk image may work with Q35 or i440fx, or work with any of virtio, ide or sata disk. So that already means values have to be arrays, not scalars. You could do that with a simple key,value list, but only by defining a mapping of arrays into a flattened form. eg do we allow repeated keys, or do we allow array indexes on keys.

Quoted 6 lines

The point here is to allow users to simply copy an existing disk image, and it will contain enough hints for a cloud stack to choose reasonable defaults for machine-type and disk type automatically. Requiring the user to perform a separate step to encapsulate the disk image in another file format defeats the whole purpose of the proposal.

It doesn't have to mean more work for the user - the application that is used to create the image can do that on their behalf. oVirt for example can import/export OVA files, containing OVF metadata. I could imagine virt-manager, and other tools adding export ability without much trouble if this was deemed a desirable thing. Bundling gives ability to have multiple disk images in one archive, which is something OVF does.

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 :|
#7 lore raw
Quoted 22 lines · Daniel P. Berrangé
Quoted 9 lines · Eduardo Habkost
Quoted 8 lines · Markus Armbruster

Eduardo Habkost <[email protected]> writes:

[...]

Quoted 3 lines

About being more expressive than just a single list of key,value pairs, I don't see any evidence of that being necessary for the problems we're trying to address.

Short history of a configuration format you might have encountered:

[snip]

Quoted 8 lines
Quoted 5 lines

How confident are we a single list of (key, value) is really all we're going to need?

Even if we think it is, would it be possible to provide for a future extension to trees at next to no cost?

I'm confident that a list of key,values is all we need for the current problem.

Quoted 6 lines

I'm not convinced. A disk image may work with Q35 or i440fx, or work with any of virtio, ide or sata disk. So that already means values have to be arrays, not scalars. You could do that with a simple key,value list, but only by defining a mapping of arrays into a flattened form. eg do we allow repeated keys, or do we allow array indexes on keys.

No problem, we can support trees if it's necessary.

Quoted 7 lines
Quoted 6 lines

The point here is to allow users to simply copy an existing disk image, and it will contain enough hints for a cloud stack to choose reasonable defaults for machine-type and disk type automatically. Requiring the user to perform a separate step to encapsulate the disk image in another file format defeats the whole purpose of the proposal.

Quoted 7 lines

It doesn't have to mean more work for the user - the application that is used to create the image can do that on their behalf. oVirt for example can import/export OVA files, containing OVF metadata. I could imagine virt-manager, and other tools adding export ability without much trouble if this was deemed a desirable thing. Bundling gives ability to have multiple disk images in one archive, which is something OVF does.

I have the impression that "the application that is used to create the image" is a very large set. It can be virt-manager, virt-install, virt-manager, or even QEMU itself.

Today people can simply create a VM on virt-manager, or run QEMU manually, and upload the qcow2 image directly from its original location (they don't need to copy/export it). Don't we want the same procedure to keep working instead of requiring users to use another tool?

Signature · 1 line
Eduardo
#13 lore raw
In reply to Eduardo Habkost
Quoted 33 lines · Eduardo Habkost
Quoted 25 lines · Daniel P. Berrangé
Quoted 10 lines · Michael S. Tsirkin

Hi!
Right now, QEMU supports multiple machine types within a given architecture. This was the case for many architectures (like ARM) for a while, somewhat more recently this is the case for x86 with I440FX and Q35 options.

Unfortunately this means that it's no longer possible to more or less reliably boot a VM just given a disk image, even if you select the correct QEMU binary:
you must supply the correct machine type.

You must /sometimes/ supply the correct machine type.

It is quite dependent on the guest OS you have installed, and even just how the guest OS is configured. In general Linux is very flexible and can adapt to a wide range of hardware, automatically detecting things as needed. It is possible for a sysadmin to build a Linux image in a way that would only work with I440FX, but I don't think it would be common to see that. Many distros build and distribute disk images that can work across VMWare, KVM, and VirtualBox which all have very quite different hardware. Non-x86 archs may be more fussy but I don't have personal experiance with them

Quoted 3 lines

Windows is probably where things get more tricky, as it is not happy with disks moving between different controller types for example, and you might trigger license activation again.

All I'm suggesting here is just adding extra hints that OpenStack can use.

Quoted 8 lines

I have very specific goal here: the goal is to make it less painful to users when OpenStack+libvirt+QEMU switch to using a different machine-type by default (q35), and/or when guest OSes stop supporting pc-i440fx. I assume this is a goal for OpenStack as well.

We can make the solution to be more extensible and solve other problems as well, but my original goal is the one above.

Configuring the machine type is just one thing that users would do with OpenStack though. A simple example might be

    openstack image set \
         --property hw_disk_bus=scsi \
	 --property hw_vif_model=e1000e

Or if they're using libosinfo to set preferred devices

    openstack image set \
         --property os_distro=fedora26

which will identify virtio-blk & virtio-net as disk+nic respectively. Using libosinfo is more flexible than setting the hw_disk_bus & hw_vif_model explicitly, because libosinfo will report multiple devices that can be used, and the virt driver can then pick one which best suits the particular host or hypervisor.

Setting a non-default machine type is one extra prop

    openstack image set \
         --property hw_machine_type=q35
         --property os_distro=fedora26

So while your immediate motivation is only considering the machine type, from the Openstack POV thats only one property out of many that users might be setting.

Quoted 9 lines
Quoted 5 lines

That said I'm not really convinced that using the qcow2 headers is a good plan. We have many disk image formats in common use, qcow2 is just one. Even if the user provides the image in qcow2 format, that doesn't mean that mgmt apps actually store the qcow2 file.

Why this OpenStack implementation detail matters? Once the hints are included in the input, it's up to OpenStack to choose how to deal with it.

Well openstack aims to support multiple hypervisors - if there's a choice between implementing something that is a cross-vendor standard like OVF, or implementing something that only works with qcow2, the latter is not very appealing to support.

Quoted 11 lines
Quoted 7 lines

The closest to a cross-hypervisor standard is OVF which can store metadata about required hardware for a VM. I'm pretty sure it does not have the concept of machine types, but maybe it has a way for people to define metadata extensions. Since it is just XML at the end of the day, even if there was nothing official in OVF, it would be possible to just define a custom XML namespace and declare a schema for that to follow.

There's nothing preventing OVF from supporting the same kind of hints.

Quoted 8 lines

I just don't think we should require people to migrate to OVF if all they need is to tell OpenStack what's the recommended machine-type for a guest image.

Requiring a different image format seems very likely to not fulfill the goal I stated above: it will require using different tools to create the guest images, and we can't force everybody publishing guest images to stop using qcow2.

It doesn't have to require different tools - existing tools could create a OVF/OVA file for the disk image as part of an "export" process.

Quoted 11 lines
Quoted 8 lines
Quoted 3 lines

- We most likely shouldn't get backend parameters from the image

Thoughts?

I tend to think we'd be better looking at what we can do in the context of an existing standard like OVF rather than inventing something that only works with qcow2. I think it would need to be more expressive than just a single list of key,value pairs for each item.

Why you claim we are inventing something that only works with qcow2?

It works with a disk image format that has ability to record extra metadata. With raw files you would have to have a separate file to record it, likewise for any other vendor disk formats that are not extended.

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 :|
#14 lore raw
Quoted 62 lines · Daniel P. Berrangé
Quoted 33 lines · Eduardo Habkost
Quoted 25 lines · Daniel P. Berrangé
Quoted 10 lines · Michael S. Tsirkin

Hi!
Right now, QEMU supports multiple machine types within a given architecture. This was the case for many architectures (like ARM) for a while, somewhat more recently this is the case for x86 with I440FX and Q35 options.

Unfortunately this means that it's no longer possible to more or less reliably boot a VM just given a disk image, even if you select the correct QEMU binary:
you must supply the correct machine type.

You must /sometimes/ supply the correct machine type.

It is quite dependent on the guest OS you have installed, and even just how the guest OS is configured. In general Linux is very flexible and can adapt to a wide range of hardware, automatically detecting things as needed. It is possible for a sysadmin to build a Linux image in a way that would only work with I440FX, but I don't think it would be common to see that. Many distros build and distribute disk images that can work across VMWare, KVM, and VirtualBox which all have very quite different hardware. Non-x86 archs may be more fussy but I don't have personal experiance with them

Quoted 3 lines

Windows is probably where things get more tricky, as it is not happy with disks moving between different controller types for example, and you might trigger license activation again.

All I'm suggesting here is just adding extra hints that OpenStack can use.

Quoted 8 lines

I have very specific goal here: the goal is to make it less painful to users when OpenStack+libvirt+QEMU switch to using a different machine-type by default (q35), and/or when guest OSes stop supporting pc-i440fx. I assume this is a goal for OpenStack as well.

We can make the solution to be more extensible and solve other problems as well, but my original goal is the one above.

Configuring the machine type is just one thing that users would do with OpenStack though. A simple example might be

    openstack image set \
         --property hw_disk_bus=scsi \
	 --property hw_vif_model=e1000e

Or if they're using libosinfo to set preferred devices

    openstack image set \
         --property os_distro=fedora26

which will identify virtio-blk & virtio-net as disk+nic respectively. Using libosinfo is more flexible than setting the hw_disk_bus & hw_vif_model explicitly, because libosinfo will report multiple devices that can be used, and the virt driver can then pick one which best suits the particular host or hypervisor.

Quoted 5 lines

Setting a non-default machine type is one extra prop

    openstack image set \
         --property hw_machine_type=q35
         --property os_distro=fedora26

Nice. Are these just hypothetical examples, or something that already works?

Quoted 4 lines

So while your immediate motivation is only considering the machine type, from the Openstack POV thats only one property out of many that users might be setting.

Agreed.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

That said I'm not really convinced that using the qcow2 headers is a good plan. We have many disk image formats in common use, qcow2 is just one. Even if the user provides the image in qcow2 format, that doesn't mean that mgmt apps actually store the qcow2 file.

Quoted 8 lines
Quoted 3 lines

Why this OpenStack implementation detail matters? Once the hints are included in the input, it's up to OpenStack to choose how to deal with it.

Well openstack aims to support multiple hypervisors - if there's a choice between implementing something that is a cross-vendor standard like OVF, or implementing something that only works with qcow2, the latter is not very appealing to support.

I still don't understand why you claim this would only work with qcow2. If somebody wants to implement the same functionality in OVF, it's also possible.

Quoted 15 lines
Quoted 15 lines
Quoted 7 lines

The closest to a cross-hypervisor standard is OVF which can store metadata about required hardware for a VM. I'm pretty sure it does not have the concept of machine types, but maybe it has a way for people to define metadata extensions. Since it is just XML at the end of the day, even if there was nothing official in OVF, it would be possible to just define a custom XML namespace and declare a schema for that to follow.

There's nothing preventing OVF from supporting the same kind of hints.

I just don't think we should require people to migrate to OVF if all they need is to tell OpenStack what's the recommended machine-type for a guest image.

Quoted 8 lines
Quoted 4 lines

Requiring a different image format seems very likely to not fulfill the goal I stated above: it will require using different tools to create the guest images, and we can't force everybody publishing guest images to stop using qcow2.

It doesn't have to require different tools - existing tools could create a OVF/OVA file for the disk image as part of an "export" process.

Requiring a new "export" step that wasn't required before is requiring a different tool, isn't it?

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

- We most likely shouldn't get backend parameters from the image

Thoughts?

I tend to think we'd be better looking at what we can do in the context of an existing standard like OVF rather than inventing something that only works with qcow2. I think it would need to be more expressive than just a single list of key,value pairs for each item.

Quoted 7 lines
Quoted 2 lines

Why you claim we are inventing something that only works with qcow2?

It works with a disk image format that has ability to record extra metadata. With raw files you would have to have a separate file to record it, likewise for any other vendor disk formats that are not extended.

So this could work with both qcow2 and OVF (and maybe other formats if others want to extend them), wouldn't it?

Signature · 1 line
Eduardo
#16 lore raw
In reply to Daniel P. Berrangé

Hi,

Quoted 8 lines

You must /sometimes/ supply the correct machine type.

It is quite dependent on the guest OS you have installed, and even just how the guest OS is configured. In general Linux is very flexible and can adapt to a wide range of hardware, automatically detecting things as needed. It is possible for a sysadmin to build a Linux image in a way that would only work with I440FX, but I don't think it would be common to see that.

I think it would be pretty hard to actually build such an image.

The more critical thing for linux guests is the storage driver which must be included into the initrd so the image can mount the root filesystem. And the firmware, bios vs. uefi is more critical than pc vs. q35.

Quoted 9 lines

That said I'm not really convinced that using the qcow2 headers is a good plan. We have many disk image formats in common use, qcow2 is just one. Even if the user provides the image in qcow2 format, that doesn't mean that mgmt apps actually store the qcow2 file.

I tend to think we'd be better looking at what we can do in the context of an existing standard like OVF rather than inventing something that only works with qcow2. I think it would need to be more expressive than just a single list of key,value pairs for each item.

Embed OVF metadata in the qcow2 image?

cheers,
Gerd

#29 lore raw
In reply to Michael S. Tsirkin

Hi,

Am 18.05.2018 um 17:30 schrieb Michael S. Tsirkin:

Quoted 3 lines

Unfortunately this means that it's no longer possible to more or less reliably boot a VM just given a disk image, even if you select the correct QEMU binary:

...

Quoted 3 lines

Would it be reasonable to support storing this information in the qcow image itself? For example, I can see it following immediately the backing file path within the image.

- This looks like a layering violation
- what happens when you have multiple (conflicting) images like a VM with 2 image files?

Philipp

PS: this is even more an issue for restoring snapshots as you the must launch a new QEMU process with the exact layout of the saving QEMU process - otherwise LoadVM will just fail.
PPS: I'm afraid of someone suggesting such an abomination as those self extracting archives using shell scripts at the beginning and an compressed archive BLOB at the end of the same file.

#17 lore raw
In reply to Gerd Hoffmann
Quoted 23 lines · Gerd Hoffmann

Hi,

Quoted 8 lines

You must /sometimes/ supply the correct machine type.

It is quite dependent on the guest OS you have installed, and even just how the guest OS is configured. In general Linux is very flexible and can adapt to a wide range of hardware, automatically detecting things as needed. It is possible for a sysadmin to build a Linux image in a way that would only work with I440FX, but I don't think it would be common to see that.

I think it would be pretty hard to actually build such an image.

The more critical thing for linux guests is the storage driver which must be included into the initrd so the image can mount the root filesystem. And the firmware, bios vs. uefi is more critical than pc vs. q35.

Quoted 4 lines

That said I'm not really convinced that using the qcow2 headers is a good plan. We have many disk image formats in common use, qcow2 is just one. Even if the user provides the image in qcow2 format, that doesn't mean that mgmt apps actually store the qcow2 file.

Quoted 6 lines
Quoted 4 lines

I tend to think we'd be better looking at what we can do in the context of an existing standard like OVF rather than inventing something that only works with qcow2. I think it would need to be more expressive than just a single list of key,value pairs for each item.

Embed OVF metadata in the qcow2 image?

I'm all for using the same standard for specifying machine hints on both cases.

Now, is there an existing mechanism for virtual hardware hints (not requirements) in OVF, or we have to invent one?

Signature · 1 line
Eduardo
#18 lore raw
In reply to Gerd Hoffmann
Quoted 11 lines · Gerd Hoffmann

Hi,

Quoted 8 lines

You must /sometimes/ supply the correct machine type.

It is quite dependent on the guest OS you have installed, and even just how the guest OS is configured. In general Linux is very flexible and can adapt to a wide range of hardware, automatically detecting things as needed. It is possible for a sysadmin to build a Linux image in a way that would only work with I440FX, but I don't think it would be common to see that.

Quoted 6 lines

I think it would be pretty hard to actually build such an image.

The more critical thing for linux guests is the storage driver which must be included into the initrd so the image can mount the root filesystem. And the firmware, bios vs. uefi is more critical than pc vs. q35.

I think we can start by finding a location to embed a string in a qcow image, add ability for qemu-img to set and get this string. We can discuss how it's formatted separately.

Quoted 10 lines
Quoted 9 lines

That said I'm not really convinced that using the qcow2 headers is a good plan. We have many disk image formats in common use, qcow2 is just one. Even if the user provides the image in qcow2 format, that doesn't mean that mgmt apps actually store the qcow2 file.

I tend to think we'd be better looking at what we can do in the context of an existing standard like OVF rather than inventing something that only works with qcow2. I think it would need to be more expressive than just a single list of key,value pairs for each item.

Quoted 4 lines

Embed OVF metadata in the qcow2 image?

cheers,
Gerd

What would be helpful is if we could tell the user who wonders how to run an image "hey you probably want flags X,Y and Z". I can see how we could have an option to either stick a bit of XML there, or just some QEMU flags.

Signature · 1 line
MST
#19 lore raw

Am 22.05.2018 um 16:19 hat Michael S. Tsirkin geschrieben:

Quoted 14 lines · Gerd Hoffmann
Quoted 13 lines

Hi,

Quoted 8 lines

You must /sometimes/ supply the correct machine type.

It is quite dependent on the guest OS you have installed, and even just how the guest OS is configured. In general Linux is very flexible and can adapt to a wide range of hardware, automatically detecting things as needed. It is possible for a sysadmin to build a Linux image in a way that would only work with I440FX, but I don't think it would be common to see that.

I think it would be pretty hard to actually build such an image.

Quoted 8 lines
Quoted 4 lines

The more critical thing for linux guests is the storage driver which must be included into the initrd so the image can mount the root filesystem. And the firmware, bios vs. uefi is more critical than pc vs. q35.

I think we can start by finding a location to embed a string in a qcow image, add ability for qemu-img to set and get this string. We can discuss how it's formatted separately.

If we want it, we'll find a place to store it.

But the first thing we need is a spec for what's actually in it. Just storing a machine type hint would be a one-off hack that wouldn't last very long before we want to add the next thing.

Essentially, what we need is a description of the virtual machine that we suggest to use with this image. We can try to reuse something existing there, like libvirt XML or OVF, or invent something new (a JSON array describing runtime options?). One difference to existing formats is probably that we want only frontends and no backends in the description.

Kevin

#20 lore raw
Quoted 30 lines · Kevin Wolf

Am 22.05.2018 um 16:19 hat Michael S. Tsirkin geschrieben:

Quoted 14 lines · Gerd Hoffmann
Quoted 13 lines

Hi,

Quoted 8 lines

You must /sometimes/ supply the correct machine type.

It is quite dependent on the guest OS you have installed, and even just how the guest OS is configured. In general Linux is very flexible and can adapt to a wide range of hardware, automatically detecting things as needed. It is possible for a sysadmin to build a Linux image in a way that would only work with I440FX, but I don't think it would be common to see that.

I think it would be pretty hard to actually build such an image.

Quoted 8 lines
Quoted 4 lines

The more critical thing for linux guests is the storage driver which must be included into the initrd so the image can mount the root filesystem. And the firmware, bios vs. uefi is more critical than pc vs. q35.

I think we can start by finding a location to embed a string in a qcow image, add ability for qemu-img to set and get this string. We can discuss how it's formatted separately.

If we want it, we'll find a place to store it.

But the first thing we need is a spec for what's actually in it. Just storing a machine type hint would be a one-off hack that wouldn't last very long before we want to add the next thing.

Quoted 6 lines

Essentially, what we need is a description of the virtual machine that we suggest to use with this image. We can try to reuse something existing there, like libvirt XML or OVF, or invent something new (a JSON array describing runtime options?). One difference to existing formats is probably that we want only frontends and no backends in the description.

The OVF virtual hardware description might be appropriate to define what's required vs what's recommended, to support multiple machine-types, and ranges of valid values for variables.

Pro: management software can reuse exactly the same logic for qcow2 machine descriptions and OVF machine descriptions.

Con: OVF is a pretty complex specification.

Signature · 1 line
Eduardo
#21 lore raw
In reply to Kevin Wolf
Quoted 30 lines · Kevin Wolf

Am 22.05.2018 um 16:19 hat Michael S. Tsirkin geschrieben:

Quoted 14 lines · Gerd Hoffmann
Quoted 13 lines

Hi,

Quoted 8 lines

You must /sometimes/ supply the correct machine type.

It is quite dependent on the guest OS you have installed, and even just how the guest OS is configured. In general Linux is very flexible and can adapt to a wide range of hardware, automatically detecting things as needed. It is possible for a sysadmin to build a Linux image in a way that would only work with I440FX, but I don't think it would be common to see that.

I think it would be pretty hard to actually build such an image.

Quoted 8 lines
Quoted 4 lines

The more critical thing for linux guests is the storage driver which must be included into the initrd so the image can mount the root filesystem. And the firmware, bios vs. uefi is more critical than pc vs. q35.

I think we can start by finding a location to embed a string in a qcow image, add ability for qemu-img to set and get this string. We can discuss how it's formatted separately.

If we want it, we'll find a place to store it.

But the first thing we need is a spec for what's actually in it. Just storing a machine type hint would be a one-off hack that wouldn't last very long before we want to add the next thing.

Quoted 7 lines

Essentially, what we need is a description of the virtual machine that we suggest to use with this image. We can try to reuse something existing there, like libvirt XML or OVF, or invent something new (a JSON array describing runtime options?). One difference to existing formats is probably that we want only frontends and no backends in the description.

Do we really need a uniform way and require compliance to the standard we choose, and implement verification in the block driver, or can we get away with a description field that accepts any text and leave it to the user to decide what to put there? In the header we could assign a Content-type field that defaults to 'text/plain' to the description, that way apps can mark the data as "application/ovf" if they want, or whatever the upper layer decides.

Fam

#22 lore raw

Am 23.05.2018 um 04:12 hat Fam Zheng geschrieben:

Quoted 39 lines · Kevin Wolf
Quoted 30 lines

Am 22.05.2018 um 16:19 hat Michael S. Tsirkin geschrieben:

Quoted 14 lines · Gerd Hoffmann
Quoted 13 lines

Hi,

Quoted 8 lines

You must /sometimes/ supply the correct machine type.

It is quite dependent on the guest OS you have installed, and even just how the guest OS is configured. In general Linux is very flexible and can adapt to a wide range of hardware, automatically detecting things as needed. It is possible for a sysadmin to build a Linux image in a way that would only work with I440FX, but I don't think it would be common to see that.

I think it would be pretty hard to actually build such an image.

Quoted 8 lines
Quoted 4 lines

The more critical thing for linux guests is the storage driver which must be included into the initrd so the image can mount the root filesystem. And the firmware, bios vs. uefi is more critical than pc vs. q35.

I think we can start by finding a location to embed a string in a qcow image, add ability for qemu-img to set and get this string. We can discuss how it's formatted separately.

If we want it, we'll find a place to store it.

But the first thing we need is a spec for what's actually in it. Just storing a machine type hint would be a one-off hack that wouldn't last very long before we want to add the next thing.

Quoted 7 lines

Essentially, what we need is a description of the virtual machine that we suggest to use with this image. We can try to reuse something existing there, like libvirt XML or OVF, or invent something new (a JSON array describing runtime options?). One difference to existing formats is probably that we want only frontends and no backends in the description.

Quoted 6 lines

Do we really need a uniform way and require compliance to the standard we choose, and implement verification in the block driver, or can we get away with a description field that accepts any text and leave it to the user to decide what to put there? In the header we could assign a Content-type field that defaults to 'text/plain' to the description, that way apps can mark the data as "application/ovf" if they want, or whatever the upper layer decides.

Yes, we can. But I'm not sure if I want. Providing low-level features without telling users how they are supposed to be used usually results in a big surprise for both sides eventually.

Kevin

#8 lore raw
In reply to Eduardo Habkost
Quoted 52 lines · Eduardo Habkost
Quoted 22 lines · Daniel P. Berrangé
Quoted 9 lines · Eduardo Habkost
Quoted 8 lines · Markus Armbruster

Eduardo Habkost <[email protected]> writes:

[...]

Quoted 3 lines

About being more expressive than just a single list of key,value pairs, I don't see any evidence of that being necessary for the problems we're trying to address.

Short history of a configuration format you might have encountered:

[snip]

Quoted 8 lines
Quoted 5 lines

How confident are we a single list of (key, value) is really all we're going to need?

Even if we think it is, would it be possible to provide for a future extension to trees at next to no cost?

I'm confident that a list of key,values is all we need for the current problem.

Quoted 6 lines

I'm not convinced. A disk image may work with Q35 or i440fx, or work with any of virtio, ide or sata disk. So that already means values have to be arrays, not scalars. You could do that with a simple key,value list, but only by defining a mapping of arrays into a flattened form. eg do we allow repeated keys, or do we allow array indexes on keys.

No problem, we can support trees if it's necessary.

Quoted 7 lines
Quoted 6 lines

The point here is to allow users to simply copy an existing disk image, and it will contain enough hints for a cloud stack to choose reasonable defaults for machine-type and disk type automatically. Requiring the user to perform a separate step to encapsulate the disk image in another file format defeats the whole purpose of the proposal.

Quoted 7 lines

It doesn't have to mean more work for the user - the application that is used to create the image can do that on their behalf. oVirt for example can import/export OVA files, containing OVF metadata. I could imagine virt-manager, and other tools adding export ability without much trouble if this was deemed a desirable thing. Bundling gives ability to have multiple disk images in one archive, which is something OVF does.

I have the impression that "the application that is used to create the image" is a very large set. It can be virt-manager, virt-install, virt-manager, or even QEMU itself.

Quoted 5 lines

Today people can simply create a VM on virt-manager, or run QEMU manually, and upload the qcow2 image directly from its original location (they don't need to copy/export it). Don't we want the same procedure to keep working instead of requiring users to use another tool?

Today, I can take the disk out of my old computer, put it into my new computer, and it just works. Don't we want the same procedure to keep working forever?

Sadly, wanting something badly enough doesn't make actual solutions any easier :)

My point is: disk images (real or virtual) keep working in different hardware contexts by a mixture of flexibility built into system software on the image, disciplined evolution of hardware (real or virtual), and dumb luck. It works until it doesn't. And then you get to tinker.

With OVF, you solve the problem further up the stack: you do virtual appliances instead of disk images.

How much space that leaves for useful solutions at the level of QEMU I can't say.

#9 lore raw
Quoted 60 lines · Markus Armbruster
Quoted 52 lines · Eduardo Habkost
Quoted 22 lines · Daniel P. Berrangé
Quoted 9 lines · Eduardo Habkost
Quoted 8 lines · Markus Armbruster

Eduardo Habkost <[email protected]> writes:

[...]

Quoted 3 lines

About being more expressive than just a single list of key,value pairs, I don't see any evidence of that being necessary for the problems we're trying to address.

Short history of a configuration format you might have encountered:

[snip]

Quoted 8 lines
Quoted 5 lines

How confident are we a single list of (key, value) is really all we're going to need?

Even if we think it is, would it be possible to provide for a future extension to trees at next to no cost?

I'm confident that a list of key,values is all we need for the current problem.

Quoted 6 lines

I'm not convinced. A disk image may work with Q35 or i440fx, or work with any of virtio, ide or sata disk. So that already means values have to be arrays, not scalars. You could do that with a simple key,value list, but only by defining a mapping of arrays into a flattened form. eg do we allow repeated keys, or do we allow array indexes on keys.

No problem, we can support trees if it's necessary.

Quoted 7 lines
Quoted 6 lines

The point here is to allow users to simply copy an existing disk image, and it will contain enough hints for a cloud stack to choose reasonable defaults for machine-type and disk type automatically. Requiring the user to perform a separate step to encapsulate the disk image in another file format defeats the whole purpose of the proposal.

Quoted 7 lines

It doesn't have to mean more work for the user - the application that is used to create the image can do that on their behalf. oVirt for example can import/export OVA files, containing OVF metadata. I could imagine virt-manager, and other tools adding export ability without much trouble if this was deemed a desirable thing. Bundling gives ability to have multiple disk images in one archive, which is something OVF does.

I have the impression that "the application that is used to create the image" is a very large set. It can be virt-manager, virt-install, virt-manager, or even QEMU itself.

Quoted 5 lines

Today people can simply create a VM on virt-manager, or run QEMU manually, and upload the qcow2 image directly from its original location (they don't need to copy/export it). Don't we want the same procedure to keep working instead of requiring users to use another tool?

Quoted 3 lines

Today, I can take the disk out of my old computer, put it into my new computer, and it just works. Don't we want the same procedure to keep working forever?

I don't think the comparison is fair: downloading hard disk images for bare metal hardware is not as common as downloading guest disk images for cloud infrastructure.

Quoted 3 lines

Sadly, wanting something badly enough doesn't make actual solutions any easier :)

This part is true. :)

Quoted 5 lines

My point is: disk images (real or virtual) keep working in different hardware contexts by a mixture of flexibility built into system software on the image, disciplined evolution of hardware (real or virtual), and dumb luck. It works until it doesn't. And then you get to tinker.

Personally, I believe that tools for running and managing virtual hardware can and should be smarter than real hardware.

Quoted 4 lines

With OVF, you solve the problem further up the stack: you do virtual appliances instead of disk images.

I guess the main problem is that people are already using disk images as if they were virtual appliances.

We can tell people to stop doing that and use OVF, but then we won't make anybody's life any easier: publishers of images might need to generate both qcow2 and OVF images if they want it to work with older hosts; consumers will need to find out if they need qcow2 or OVF.

But I work too deep down the stack to tell if it's really important to avoid these problems or not. And as you said, this doesn't make actual solutions any easier.

Quoted 2 lines

How much space that leaves for useful solutions at the level of QEMU I can't say.

I have no doubt about "useful", but I'm not sure about "important".

I guess the question is if we have people with time and resources to work on solutions (whether using qcow2 or OVF).

Signature · 1 line
Eduardo
#23 lore raw
In reply to Kevin Wolf
Quoted 47 lines · Kevin Wolf

Am 23.05.2018 um 04:12 hat Fam Zheng geschrieben:

Quoted 39 lines · Kevin Wolf
Quoted 30 lines

Am 22.05.2018 um 16:19 hat Michael S. Tsirkin geschrieben:

Quoted 14 lines · Gerd Hoffmann
Quoted 13 lines

Hi,

Quoted 8 lines

You must /sometimes/ supply the correct machine type.

It is quite dependent on the guest OS you have installed, and even just how the guest OS is configured. In general Linux is very flexible and can adapt to a wide range of hardware, automatically detecting things as needed. It is possible for a sysadmin to build a Linux image in a way that would only work with I440FX, but I don't think it would be common to see that.

I think it would be pretty hard to actually build such an image.

Quoted 8 lines
Quoted 4 lines

The more critical thing for linux guests is the storage driver which must be included into the initrd so the image can mount the root filesystem. And the firmware, bios vs. uefi is more critical than pc vs. q35.

I think we can start by finding a location to embed a string in a qcow image, add ability for qemu-img to set and get this string. We can discuss how it's formatted separately.

If we want it, we'll find a place to store it.

But the first thing we need is a spec for what's actually in it. Just storing a machine type hint would be a one-off hack that wouldn't last very long before we want to add the next thing.

Quoted 7 lines

Essentially, what we need is a description of the virtual machine that we suggest to use with this image. We can try to reuse something existing there, like libvirt XML or OVF, or invent something new (a JSON array describing runtime options?). One difference to existing formats is probably that we want only frontends and no backends in the description.

Quoted 6 lines

Do we really need a uniform way and require compliance to the standard we choose, and implement verification in the block driver, or can we get away with a description field that accepts any text and leave it to the user to decide what to put there? In the header we could assign a Content-type field that defaults to 'text/plain' to the description, that way apps can mark the data as "application/ovf" if they want, or whatever the upper layer decides.

Quoted 5 lines

Yes, we can. But I'm not sure if I want. Providing low-level features without telling users how they are supposed to be used usually results in a big surprise for both sides eventually.

Kevin

The idea to include a format in there sounds very reasonable to me though. We can then start with a simple text format just showing the QEMU command line, and others can reuse it for OVF format, etc.

Signature · 1 line
MST
#10 lore raw
In reply to Eduardo Habkost
Quoted 61 lines · Eduardo Habkost
Quoted 60 lines · Markus Armbruster
Quoted 57 lines · Eduardo Habkost
Quoted 22 lines · Daniel P. Berrangé
Quoted 9 lines · Eduardo Habkost
Quoted 8 lines · Markus Armbruster

Eduardo Habkost <[email protected]> writes:

[...]

Quoted 3 lines

About being more expressive than just a single list of key,value pairs, I don't see any evidence of that being necessary for the problems we're trying to address.

Short history of a configuration format you might have encountered:

[snip]

Quoted 8 lines
Quoted 5 lines

How confident are we a single list of (key, value) is really all we're going to need?

Even if we think it is, would it be possible to provide for a future extension to trees at next to no cost?

I'm confident that a list of key,values is all we need for the current problem.

Quoted 6 lines

I'm not convinced. A disk image may work with Q35 or i440fx, or work with any of virtio, ide or sata disk. So that already means values have to be arrays, not scalars. You could do that with a simple key,value list, but only by defining a mapping of arrays into a flattened form. eg do we allow repeated keys, or do we allow array indexes on keys.

No problem, we can support trees if it's necessary.

Quoted 7 lines
Quoted 6 lines

The point here is to allow users to simply copy an existing disk image, and it will contain enough hints for a cloud stack to choose reasonable defaults for machine-type and disk type automatically. Requiring the user to perform a separate step to encapsulate the disk image in another file format defeats the whole purpose of the proposal.

Quoted 7 lines

It doesn't have to mean more work for the user - the application that is used to create the image can do that on their behalf. oVirt for example can import/export OVA files, containing OVF metadata. I could imagine virt-manager, and other tools adding export ability without much trouble if this was deemed a desirable thing. Bundling gives ability to have multiple disk images in one archive, which is something OVF does.

I have the impression that "the application that is used to create the image" is a very large set. It can be virt-manager, virt-install, virt-manager, or even QEMU itself.

Today people can simply create a VM on virt-manager, or run QEMU manually, and upload the qcow2 image directly from its original location (they don't need to copy/export it). Don't we want the same procedure to keep working instead of requiring users to use another tool?

Quoted 7 lines
Quoted 3 lines

Today, I can take the disk out of my old computer, put it into my new computer, and it just works. Don't we want the same procedure to keep working forever?

I don't think the comparison is fair: downloading hard disk images for bare metal hardware is not as common as downloading guest disk images for cloud infrastructure.

Can't let "fair" get in the way of a witticism!

Seriously, though: are disk images a sane way to package software?

Quoted 6 lines
Quoted 2 lines

Sadly, wanting something badly enough doesn't make actual solutions any easier :)

This part is true. :)

Quoted 1 line
Quoted 7 lines
Quoted 4 lines

My point is: disk images (real or virtual) keep working in different hardware contexts by a mixture of flexibility built into system software on the image, disciplined evolution of hardware (real or virtual), and dumb luck. It works until it doesn't. And then you get to tinker.

Personally, I believe that tools for running and managing virtual hardware can and should be smarter than real hardware.

Point taken.

Adding hints to disk images (which is how I understand your proposal) could make them (with a bit of luck) work more often. Luck, because the receiving end needs to interpret the hints in a way that makes the image work. In other words, guesswork and duct tape. Both guesswork and duct tape are incredibly useful when no better tools are at hand. Is that the case here?

Quoted 4 lines
Quoted 3 lines

With OVF, you solve the problem further up the stack: you do virtual appliances instead of disk images.

Quoted 8 lines

I guess the main problem is that people are already using disk images as if they were virtual appliances.

We can tell people to stop doing that and use OVF, but then we won't make anybody's life any easier: publishers of images might need to generate both qcow2 and OVF images if they want it to work with older hosts; consumers will need to find out if they need qcow2 or OVF.

I'm afraid providing for "hints" in QCOW2 could only add problems. To pick the right hints, publishers need to predict how future software consuming the image will interpret them. Consumers may have to configure their software to interpret hints in various ways.

I figure my belly-aching is due to the general fuzziness of "hints", at least in my mind. Would it even be possible to do anything remotely similar to a specification for them?

Quoted 10 lines

But I work too deep down the stack to tell if it's really important to avoid these problems or not. And as you said, this doesn't make actual solutions any easier.

Quoted 2 lines

How much space that leaves for useful solutions at the level of QEMU I can't say.

I have no doubt about "useful", but I'm not sure about "important".

I'm in doubt on "feasible", but that might be due to me not fully grasping the intended use of hints.

Quoted 2 lines

I guess the question is if we have people with time and resources to work on solutions (whether using qcow2 or OVF).

#15 lore raw
In reply to Eduardo Habkost
Quoted 1 line · Eduardo Habkost

On Mon, May 21, 2018 at 09:18:17PM +0100, Daniel P. Berrangé wrote:

[...]

(Just catching up with this thread.)

[...]

Quoted 15 lines
Quoted 15 lines
Quoted 8 lines

I have very specific goal here: the goal is to make it less painful to users when OpenStack+libvirt+QEMU switch to using a different machine-type by default (q35), and/or when guest OSes stop supporting pc-i440fx. I assume this is a goal for OpenStack as well.

We can make the solution to be more extensible and solve other problems as well, but my original goal is the one above.

Configuring the machine type is just one thing that users would do with OpenStack though. A simple example might be

    openstack image set \
         --property hw_disk_bus=scsi \
	 --property hw_vif_model=e1000e

[...]

Quoted 8 lines
Quoted 5 lines

Setting a non-default machine type is one extra prop

    openstack image set \
         --property hw_machine_type=q35
         --property os_distro=fedora26

Nice. Are these just hypothetical examples, or something that already works?

No, not hypothetical -- they actually work _today_, and customers actively use it in production as we speak. Machine type could be set in two ways in OpenStack. One is as Dan noted above, which is *per* disk image. The other is per Compute node (where QEMU instances are launched), via setting a config attribute in a file (/etc/nova/nova.conf):

        [libvirt]
        ...
        hw_machine_type=x86_64=pc-q35-2.9

The above means _all_ QEMU instances launched on that Compute node will get 'pc-q35-2.9' machine type.

[...]

Signature · 1 line
/kashyap
#24 lore raw
In reply to Daniel P. Berrangé
Quoted 7 lines · Daniel P. Berrangé

The closest to a cross-hypervisor standard is OVF which can store metadata about required hardware for a VM. I'm pretty sure it does not have the concept of machine types, but maybe it has a way for people to define metadata extensions. Since it is just XML at the end of the day, even if there was nothing official in OVF, it would be possible to just define a custom XML namespace and declare a schema for that to follow.

I have a great deal of experience with the OVF "standard". TL;DR: DO NOT USE IT.

Long answer copied from a rant I wrote on an internal mailing list a while back:

Don't make the mistake of confusing OVF for a format. It's not, there are at least 4 non-interoperable OVF "format"s around:

- 2 x oVirt OVF
- VMware's OVF used in exported OVA files
- VirtualBox's OVF used in their exported OVA files

These are all different and do not interoperate *at all*. So before you decide "let's parse OVF", be precise about which format(s) you actually want to parse.

Also OVF is a hideous format. Many fields are obviously internal data dumps of VMware structures, complete with internal VMware IDs instead of descriptive names. Where there are descriptive names, they use English strings instead of keywords, like: <rasd:AllocationUnits>MetaBytes</> or my particular WTF favourite, a meaningful field which references English (only) Wikipedia:

<Disk ovf:format="http://en.wikipedia.org/wiki/Byte">

File references are split over two places, and there are other examples where data is needlessly duplicated or it's unclear what data is supposed to be.

Of course VMware Inc. are not stupid enough to use this format for their own purposes. They use a completely different format (VMX) which is a lot like YAML.

Rich.

Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
#30 lore raw
In reply to Michael S. Tsirkin

I read the whole thread and the fundamental problem is that you're mixing layers. Let qcow2 be a disk image format, and let management layers deal with metadata and how to run qemu.

What's going to happen when you have (eg) an OVA file containing qcow2 files, and the qcow2 files all have different metadata from each other and from the actual metadata in the OVA? Even the case where you've got ‘-hda file1.qcow2 -hdb file2.qcow2’ is not properly defined. What happens if someone uses ‘-M mach1 -hda file.qcow2’ and the machine type in the qcow2 file conflicts with the command line?

BTW we have a tooling (libguestfs) which can tell you what devices are supported by the guest. virt-v2v already uses libguestfs to find out the full list of devices supported by guests, and uses that to drive conversion. At some point we're going to extend virt-inspector to make this a bit easier (patches and other contributions welcome, there's a huge list of work to do on libguestfs and not enough developers to get through it).

There is however a seed of a good idea in the thread:

Quoted 4 lines

I don't think QEMU needs to use this information automatically, necessarily. I think the first step is to simply make QEMU save this information in the disk image, and making qemu-img able to read and write this information.

It would be nice if qcow2 added arbitrary data sections (which would always be ignored by qemu) for storing additional data. This could be used to create a compact qcow2 + metadata format to rival OVA for management layers to use, and there are various other uses too.

Rich.

Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
#31 lore raw
Quoted 7 lines · Richard W.M. Jones

There is however a seed of a good idea in the thread:

Quoted 4 lines

I don't think QEMU needs to use this information automatically, necessarily. I think the first step is to simply make QEMU save this information in the disk image, and making qemu-img able to read and write this information.

Quoted 6 lines

It would be nice if qcow2 added arbitrary data sections (which would always be ignored by qemu) for storing additional data. This could be used to create a compact qcow2 + metadata format to rival OVA for management layers to use, and there are various other uses too.

Rich.

I think this part is pretty uncontroversial.

But can we add data without changing the verion?

typedef struct QCowHeader {
    uint32_t magic;
    uint32_t version;
    uint64_t backing_file_offset;
    uint32_t backing_file_size;
    uint32_t mtime;
    uint64_t size; /* in bytes */
    uint8_t cluster_bits;
    uint8_t l2_bits;
    uint16_t padding;
    uint32_t crypt_method;
    uint64_t l1_table_offset;
} QEMU_PACKED QCowHeader;

How about changing mtime to a flags bitmap?
E.g. 0x1 would mean there's an extended header.

And then:

struct QCowExtHeader {
    uint64_t meta_data_offset;
    uint32_t meta_data_size;
    uint32_t meta_data_format; /* 0x0 - UTF-8 NULL-terminated string */
};

Thanks!

Signature · 1 line
MST
#32 lore raw

Am 24.05.2018 um 16:56 hat Michael S. Tsirkin geschrieben:

Quoted 13 lines · Richard W.M. Jones
Quoted 12 lines

There is however a seed of a good idea in the thread:

Quoted 4 lines

I don't think QEMU needs to use this information automatically, necessarily. I think the first step is to simply make QEMU save this information in the disk image, and making qemu-img able to read and write this information.

It would be nice if qcow2 added arbitrary data sections (which would always be ignored by qemu) for storing additional data. This could be used to create a compact qcow2 + metadata format to rival OVA for management layers to use, and there are various other uses too.

Quoted 5 lines
Quoted 1 line

Rich.

I think this part is pretty uncontroversial.

But can we add data without changing the verion?

Yes. Don't worry about where to store it, we'll solve this. Do worry about what to store.

Quoted 14 lines
typedef struct QCowHeader {
    uint32_t magic;
    uint32_t version;
    uint64_t backing_file_offset;
    uint32_t backing_file_size;
    uint32_t mtime;
    uint64_t size; /* in bytes */
    uint8_t cluster_bits;
    uint8_t l2_bits;
    uint16_t padding;
    uint32_t crypt_method;
    uint64_t l1_table_offset;
} QEMU_PACKED QCowHeader;
Quoted 2 lines

How about changing mtime to a flags bitmap?
E.g. 0x1 would mean there's an extended header.

You're looking at the qcow1 header. qcow2 has mechanisms to extend the metadata, including compatible and incompatible feature flags and a header_length field.

Kevin

#33 lore raw
Quoted 14 lines · Kevin Wolf

Am 24.05.2018 um 16:56 hat Michael S. Tsirkin geschrieben:

Quoted 13 lines · Richard W.M. Jones
Quoted 12 lines

There is however a seed of a good idea in the thread:

Quoted 4 lines

I don't think QEMU needs to use this information automatically, necessarily. I think the first step is to simply make QEMU save this information in the disk image, and making qemu-img able to read and write this information.

It would be nice if qcow2 added arbitrary data sections (which would always be ignored by qemu) for storing additional data. This could be used to create a compact qcow2 + metadata format to rival OVA for management layers to use, and there are various other uses too.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Rich.

I think this part is pretty uncontroversial.

But can we add data without changing the verion?

Yes. Don't worry about where to store it, we'll solve this. Do worry about what to store.

Let's start with a UTF-8 string.

Quoted 22 lines
Quoted 14 lines
typedef struct QCowHeader {
    uint32_t magic;
    uint32_t version;
    uint64_t backing_file_offset;
    uint32_t backing_file_size;
    uint32_t mtime;
    uint64_t size; /* in bytes */
    uint8_t cluster_bits;
    uint8_t l2_bits;
    uint16_t padding;
    uint32_t crypt_method;
    uint64_t l1_table_offset;
} QEMU_PACKED QCowHeader;
Quoted 2 lines

How about changing mtime to a flags bitmap?
E.g. 0x1 would mean there's an extended header.

You're looking at the qcow1 header. qcow2 has mechanisms to extend the metadata, including compatible and incompatible feature flags and a header_length field.

Kevin

#34 lore raw
In reply to Kevin Wolf
Quoted 14 lines · Kevin Wolf

Am 24.05.2018 um 16:56 hat Michael S. Tsirkin geschrieben:

Quoted 13 lines · Richard W.M. Jones
Quoted 12 lines

There is however a seed of a good idea in the thread:

Quoted 4 lines

I don't think QEMU needs to use this information automatically, necessarily. I think the first step is to simply make QEMU save this information in the disk image, and making qemu-img able to read and write this information.

It would be nice if qcow2 added arbitrary data sections (which would always be ignored by qemu) for storing additional data. This could be used to create a compact qcow2 + metadata format to rival OVA for management layers to use, and there are various other uses too.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Rich.

I think this part is pretty uncontroversial.

But can we add data without changing the verion?

Yes. Don't worry about where to store it, we'll solve this. Do worry about what to store.

Ideally from my point of view: named blobs. More formally, any number of (key, value) pairs where the key is a simple string, and the value is a binary blob. The binary blobs might really be XML or YAML or an icon or whatever, but qemu would not need to look inside them.

We could then attach metadata (in some to-be-decided format) to qcow2 files and create a compact rival to OVA without needing to encode any knowledge of the metadata into qemu at all.

Another use for this is allowing qcow2 files to contain names, titles, descriptions, creation date, OS icons, etc. which could be displayed in file managers.

Rich.

Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
#35 lore raw
Quoted 29 lines · Richard W.M. Jones
Quoted 14 lines · Kevin Wolf

Am 24.05.2018 um 16:56 hat Michael S. Tsirkin geschrieben:

Quoted 13 lines · Richard W.M. Jones
Quoted 12 lines

There is however a seed of a good idea in the thread:

Quoted 4 lines

I don't think QEMU needs to use this information automatically, necessarily. I think the first step is to simply make QEMU save this information in the disk image, and making qemu-img able to read and write this information.

It would be nice if qcow2 added arbitrary data sections (which would always be ignored by qemu) for storing additional data. This could be used to create a compact qcow2 + metadata format to rival OVA for management layers to use, and there are various other uses too.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Rich.

I think this part is pretty uncontroversial.

But can we add data without changing the verion?

Yes. Don't worry about where to store it, we'll solve this. Do worry about what to store.

Ideally from my point of view: named blobs. More formally, any number of (key, value) pairs where the key is a simple string, and the value is a binary blob. The binary blobs might really be XML or YAML or an icon or whatever, but qemu would not need to look inside them.

Quoted 7 lines

We could then attach metadata (in some to-be-decided format) to qcow2 files and create a compact rival to OVA without needing to encode any knowledge of the metadata into qemu at all.

Another use for this is allowing qcow2 files to contain names, titles, descriptions, creation date, OS icons, etc. which could be displayed in file managers.

Have we just reinvented resource forks?

SCNR ;)

#36 lore raw
In reply to Richard W.M. Jones
Quoted 26 lines · Richard W.M. Jones

I read the whole thread and the fundamental problem is that you're mixing layers. Let qcow2 be a disk image format, and let management layers deal with metadata and how to run qemu.

What's going to happen when you have (eg) an OVA file containing qcow2 files, and the qcow2 files all have different metadata from each other and from the actual metadata in the OVA? Even the case where you've got ‘-hda file1.qcow2 -hdb file2.qcow2’ is not properly defined. What happens if someone uses ‘-M mach1 -hda file.qcow2’ and the machine type in the qcow2 file conflicts with the command line?

BTW we have a tooling (libguestfs) which can tell you what devices are supported by the guest. virt-v2v already uses libguestfs to find out the full list of devices supported by guests, and uses that to drive conversion. At some point we're going to extend virt-inspector to make this a bit easier (patches and other contributions welcome, there's a huge list of work to do on libguestfs and not enough developers to get through it).

There is however a seed of a good idea in the thread:

Quoted 4 lines

I don't think QEMU needs to use this information automatically, necessarily. I think the first step is to simply make QEMU save this information in the disk image, and making qemu-img able to read and write this information.

Quoted 4 lines

It would be nice if qcow2 added arbitrary data sections (which would always be ignored by qemu) for storing additional data. This could be used to create a compact qcow2 + metadata format to rival OVA for management layers to use, and there are various other uses too.

As an extremist on the "qcow2 is an image data format and as such should only store data that is relevant to the virtual disk" front, I don't see the appeal.

As someone who is just naive and doesn't see the big picture, I don't see what's wrong with using a tar file that contains the image and additional data. I shudder to imagine integrating the qcow2 driver so deeply into qemu that various parts all over qemu just use it to store some data. I can't help but feel reminded of the HMP savevm command that just randomly chooses some qcow2 image to store the VM state in.

At least you're talking about just storing data. I imagine opening a qcow2 image, then reading some VM configuration, and spreading the gospel through the rest of the qemu process to initialize everything would be anything but nice.

I personally don't see why it is so bad to split the information between two files. Honestly, if you want to put disk images and VM configuration into a single file, I'd do it backwards: Put the disk image into the configuration file.

Max

#37 lore raw
Quoted 3 lines · Max Reitz

As someone who is just naive and doesn't see the big picture, I don't see what's wrong with using a tar file that contains the image and additional data.

FWIW an OVA file is exactly this: an uncompressed tar file containing disk image(s) and metadata.

Rich.

Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
#38 lore raw

Am 28.05.2018 um 20:30 hat Richard W.M. Jones geschrieben:

Quoted 7 lines · Max Reitz
Quoted 3 lines

As someone who is just naive and doesn't see the big picture, I don't see what's wrong with using a tar file that contains the image and additional data.

FWIW an OVA file is exactly this: an uncompressed tar file containing disk image(s) and metadata.

If we combine VM configuration and the disk image this way, I would still want to directly use that combined thing without having to extract its components first.

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

And if I think of a file format that can contain several different things that can be individually resized etc., I end up with qcow2 in the simple case or a full file system in the more complex case.

Kevin

#39 lore raw
Quoted 19 lines · Kevin Wolf

Am 28.05.2018 um 20:30 hat Richard W.M. Jones geschrieben:

Quoted 7 lines · Max Reitz
Quoted 3 lines

As someone who is just naive and doesn't see the big picture, I don't see what's wrong with using a tar file that contains the image and additional data.

FWIW an OVA file is exactly this: an uncompressed tar file containing disk image(s) and metadata.

If we combine VM configuration and the disk image this way, I would still want to directly use that combined thing without having to extract its components first.

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

Quoted 3 lines

And if I think of a file format that can contain several different things that can be individually resized etc., I end up with qcow2 in the simple case or a full file system in the more complex case.

Well, you end up with VMDK.

Max

#40 lore raw

Am 28.05.2018 um 20:44 hat Max Reitz geschrieben:

Quoted 20 lines · Kevin Wolf
Quoted 19 lines

Am 28.05.2018 um 20:30 hat Richard W.M. Jones geschrieben:

Quoted 7 lines · Max Reitz
Quoted 3 lines

As someone who is just naive and doesn't see the big picture, I don't see what's wrong with using a tar file that contains the image and additional data.

FWIW an OVA file is exactly this: an uncompressed tar file containing disk image(s) and metadata.

If we combine VM configuration and the disk image this way, I would still want to directly use that combined thing without having to extract its components first.

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

Quoted 5 lines
Quoted 3 lines

And if I think of a file format that can contain several different things that can be individually resized etc., I end up with qcow2 in the simple case or a full file system in the more complex case.

Well, you end up with VMDK.

I don't think VMDK can save several different objects? It can have some metadata in the descriptor, and it can spread the contents of a single object across multiple files (with extents), but I don't think it has something comparable to e.g. qcow2 snapshots, which are separate objects with an individual size that can dynamically change.

Kevin

#44 lore raw
In reply to Kevin Wolf
Quoted 5 lines · Kevin Wolf

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

We do this already in virt-v2v (using file.offset and file.size parameters in the raw driver).

For virt-v2v we only need to read the source so resizing isn't an issue. For most of the cases we're talking about the downloaded image would also be a template / base image, so I suppose only reading would be required too.

I also wrote an nbdkit tar file driver (supports writes, but not resizing).
https://manpages.debian.org/testing/nbdkit-plugin-perl/nbdkit-tar-plugin.1.en.html

Rich.

Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
#45 lore raw
Quoted 10 lines · Richard W.M. Jones
Quoted 5 lines · Kevin Wolf

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

We do this already in virt-v2v (using file.offset and file.size parameters in the raw driver).

Quoted 8 lines

For virt-v2v we only need to read the source so resizing isn't an issue. For most of the cases we're talking about the downloaded image would also be a template / base image, so I suppose only reading would be required too.

I also wrote an nbdkit tar file driver (supports writes, but not resizing).
https://manpages.debian.org/testing/nbdkit-plugin-perl/nbdkit-tar-plugin.1.en.html

I should add the other thorny issue with OVA files is that the metadata contains a checksum (SHA1 or SHA256) of the disk images. If you modify the disk images in-place in the tar file then you need to recalculate those.

Rich.

Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
#46 lore raw

Am 28.05.2018 um 23:25 hat Richard W.M. Jones geschrieben:

Quoted 16 lines · Richard W.M. Jones
Quoted 15 lines · Kevin Wolf
Quoted 5 lines

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

We do this already in virt-v2v (using file.offset and file.size parameters in the raw driver).

For virt-v2v we only need to read the source so resizing isn't an issue. For most of the cases we're talking about the downloaded image would also be a template / base image, so I suppose only reading would be required too.

Quoted 8 lines
Quoted 3 lines

I also wrote an nbdkit tar file driver (supports writes, but not resizing).
https://manpages.debian.org/testing/nbdkit-plugin-perl/nbdkit-tar-plugin.1.en.html

I should add the other thorny issue with OVA files is that the metadata contains a checksum (SHA1 or SHA256) of the disk images. If you modify the disk images in-place in the tar file then you need to recalculate those.

All of this means that OVA isn't really well suited to be used as a native format for VM configuration + images. It's just for sharing read-only images that are converted into another native format before they are used.

Which is probably fair for the use case it was made for, but means that we need something else to solve our problem.

Kevin

#41 lore raw
In reply to Kevin Wolf
Quoted 25 lines · Kevin Wolf

Am 28.05.2018 um 20:44 hat Max Reitz geschrieben:

Quoted 24 lines · Kevin Wolf
Quoted 22 lines

Am 28.05.2018 um 20:30 hat Richard W.M. Jones geschrieben:

Quoted 7 lines · Max Reitz
Quoted 3 lines

As someone who is just naive and doesn't see the big picture, I don't see what's wrong with using a tar file that contains the image and additional data.

FWIW an OVA file is exactly this: an uncompressed tar file containing disk image(s) and metadata.

If we combine VM configuration and the disk image this way, I would still want to directly use that combined thing without having to extract its components first.

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

And if I think of a file format that can contain several different things that can be individually resized etc., I end up with qcow2 in the simple case or a full file system in the more complex case.

Quoted 7 lines
Quoted 1 line

Well, you end up with VMDK.

I don't think VMDK can save several different objects? It can have some metadata in the descriptor, and it can spread the contents of a single object across multiple files (with extents), but I don't think it has something comparable to e.g. qcow2 snapshots, which are separate objects with an individual size that can dynamically change.

Right, I tried to be funny and was over-simplifying in the process.

What I meant is: You end up with an image format that is spread on a filesystem, like VMDK is (usually). Then you have some metadata descriptor file that describes the rest and multiple data object files.

(For completeness's sake: And you can use an external or an internal filesystem, that is, use multiple files (like VMDK) or have an internal filesystem (like tar, except tar doesn't allow fragmentation).)

Max

#47 lore raw
In reply to Kevin Wolf
Quoted 26 lines · Kevin Wolf

Am 28.05.2018 um 23:25 hat Richard W.M. Jones geschrieben:

Quoted 16 lines · Richard W.M. Jones
Quoted 15 lines · Kevin Wolf
Quoted 5 lines

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

We do this already in virt-v2v (using file.offset and file.size parameters in the raw driver).

For virt-v2v we only need to read the source so resizing isn't an issue. For most of the cases we're talking about the downloaded image would also be a template / base image, so I suppose only reading would be required too.

Quoted 8 lines
Quoted 3 lines

I also wrote an nbdkit tar file driver (supports writes, but not resizing).
https://manpages.debian.org/testing/nbdkit-plugin-perl/nbdkit-tar-plugin.1.en.html

I should add the other thorny issue with OVA files is that the metadata contains a checksum (SHA1 or SHA256) of the disk images. If you modify the disk images in-place in the tar file then you need to recalculate those.

Quoted 7 lines

All of this means that OVA isn't really well suited to be used as a native format for VM configuration + images. It's just for sharing read-only images that are converted into another native format before they are used.

Which is probably fair for the use case it was made for, but means that we need something else to solve our problem.

Maybe we should first narrow down our problem. Maybe you have done that already, but I'm quite in the dark still.

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture. Once we support configuring qemu solely through QMP, sure, you can do a blockdev-add and then build the machine accordingly. But that is not here today, and I'm not sure this is a good idea either, because that would mean automagic defaults for the machine-building QMP commands derived from the blockdev-add earlier, which should get a plain "No". Also, having to use QMP to build your machine wouldn't make anything easier; at least not easier than just supplying a configuration file along with the image.

(Building the magic into -blockdev might be less horrible, but such magic (adding block devices influences machine defaults) to me still doesn't seem worth not having to supply a config file along with the disk image.)

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them? But some of those images may only contain data and might be intended to be shared between multiple VMs. So those shouldn't receive the mark. Only disks with binaries should receive them.
But what if those binaries are just cross-compiled binaries for some other VM? Oh no, so not even binaries are a sure indicator... So I have no idea where the information is supposed to be stored. In any case, "the first image" just gets an outright "no" from me, and "all images" gets an "I don't think this is a good idea".

Loading is fun, too. OK, so you attach multiple disk images to a VM. Oops, they have varying machine type information... Now what? Use the information from the first one? Definitely no. Just ignore all of the information in such a case and have the user supply the machine type again? Possible, but it seems weird to me that qemu would usually guess the machine type, but once you attach some random other image to it, it suddenly fails to do that. But maybe it's just me who thinks this is weird.

OK, so let's go a step further. We have stored the machine type information in order to not have to supply a config file with the qcow2 image -- because if we did, it could just contain the machine type and that would be it.

So to me it follows naturally that just storing the machine type doesn't make much sense if we cannot also store more VM configuration in a qcow2 file, because I don't see why you should be able to ship an image without a config file only if all you need to supply is a machine type. Often, you also need to supply how much memory the VM needs (which depends on the OS on the image) or what storage controller to use (does the OS have virtio drivers? (to be fair, it usually does, because you're supplying a VM image in the first place)).

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

For one thing, I suspect it to get really ugly implementation-wise. Getting the machine type out of a disk image and actually interpreting it automatically is bad enough, but getting possibly everything out of it? It's not going to be any better.

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would think (which may
support JSON at some point?). So basically we would store the data as
a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files. I hate the idea of making qcow2 a random archive format. We have tar for that.

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into
(1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

As explained, I don't like (2), but it would be necessary for (1), so yeah.

As for (1), just why? I mean, if we want to do that, fine, but on one hand that is absolutely not what qcow2 is right now (it is a VM-agnostic disk image format), and on the other I simply don't see any good reason to. We have config files for that, they just lack the disk data. I don't see the difficulty in having to deal with two files. And even if it were too difficult for some people in some cases (to me this is really hypothetically speaking), I'd rather integrate qcow2 (or any disk image) into some other descriptive format than adding descriptive capabilities to qcow2.[1]

tl;dr: I really don't get why it's so hard to supply a config file along with a qcow2 image. Is it so hard for people to realize that a VM does not only consist of a disk?

Max

[1] It isn't like I think integrating disk images into a VM description format (like config files) is worth doing. I think having to deal with multiple files is not an issue whatsoever (but again, this may be because I haven't understood the problem). I just think that (1) it doesn't concern me as someone working on the block layer, because it wouldn't change anything about qcow2 or the block layer in general, so go ahead if you want to do anything in an area that doesn't concern me, and (2) it just seems intuitively more natural to me and I think it would be much nicer to implement. So if someone has time to spare to implement this, I wouldn't oppose it. But I'm not that someone.

#42 lore raw
In reply to Max Reitz

Am 29.05.2018 um 11:23 hat Max Reitz geschrieben:

Quoted 36 lines · Kevin Wolf
Quoted 25 lines

Am 28.05.2018 um 20:44 hat Max Reitz geschrieben:

Quoted 24 lines · Kevin Wolf
Quoted 22 lines

Am 28.05.2018 um 20:30 hat Richard W.M. Jones geschrieben:

Quoted 7 lines · Max Reitz
Quoted 3 lines

As someone who is just naive and doesn't see the big picture, I don't see what's wrong with using a tar file that contains the image and additional data.

FWIW an OVA file is exactly this: an uncompressed tar file containing disk image(s) and metadata.

If we combine VM configuration and the disk image this way, I would still want to directly use that combined thing without having to extract its components first.

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

And if I think of a file format that can contain several different things that can be individually resized etc., I end up with qcow2 in the simple case or a full file system in the more complex case.

Quoted 7 lines
Quoted 1 line

Well, you end up with VMDK.

I don't think VMDK can save several different objects? It can have some metadata in the descriptor, and it can spread the contents of a single object across multiple files (with extents), but I don't think it has something comparable to e.g. qcow2 snapshots, which are separate objects with an individual size that can dynamically change.

Right, I tried to be funny and was over-simplifying in the process.

Quoted 7 lines

What I meant is: You end up with an image format that is spread on a filesystem, like VMDK is (usually). Then you have some metadata descriptor file that describes the rest and multiple data object files.

(For completeness's sake: And you can use an external or an internal filesystem, that is, use multiple files (like VMDK) or have an internal filesystem (like tar, except tar doesn't allow fragmentation).)

Let's call the libvirt XML the image file and the qcow2 files its data object files and we're done?

I'm afraid spreading things across multiple files doesn't meet the requirements for the problem at hand, though...

Kevin

#43 lore raw
Quoted 41 lines · Kevin Wolf

Am 29.05.2018 um 11:23 hat Max Reitz geschrieben:

Quoted 40 lines · Kevin Wolf
Quoted 25 lines

Am 28.05.2018 um 20:44 hat Max Reitz geschrieben:

Quoted 24 lines · Kevin Wolf
Quoted 22 lines

Am 28.05.2018 um 20:30 hat Richard W.M. Jones geschrieben:

Quoted 7 lines · Max Reitz
Quoted 3 lines

As someone who is just naive and doesn't see the big picture, I don't see what's wrong with using a tar file that contains the image and additional data.

FWIW an OVA file is exactly this: an uncompressed tar file containing disk image(s) and metadata.

If we combine VM configuration and the disk image this way, I would still want to directly use that combined thing without having to extract its components first.

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

And if I think of a file format that can contain several different things that can be individually resized etc., I end up with qcow2 in the simple case or a full file system in the more complex case.

Quoted 7 lines
Quoted 1 line

Well, you end up with VMDK.

I don't think VMDK can save several different objects? It can have some metadata in the descriptor, and it can spread the contents of a single object across multiple files (with extents), but I don't think it has something comparable to e.g. qcow2 snapshots, which are separate objects with an individual size that can dynamically change.

Right, I tried to be funny and was over-simplifying in the process.

What I meant is: You end up with an image format that is spread on a filesystem, like VMDK is (usually). Then you have some metadata descriptor file that describes the rest and multiple data object files.

Quoted 6 lines
Quoted 3 lines

(For completeness's sake: And you can use an external or an internal filesystem, that is, use multiple files (like VMDK) or have an internal filesystem (like tar, except tar doesn't allow fragmentation).)

Let's call the libvirt XML the image file and the qcow2 files its data object files and we're done?

libvirt XML doesn't seems to be a solution for the problem, but a separate VM specification file could work anyway.

Quoted 3 lines

I'm afraid spreading things across multiple files doesn't meet the requirements for the problem at hand, though...

Yeah, I wanted to make this an extension of qcow2, so people don't have Yet Another file format to choose from. We could also let libvirt automatically write hints to disk images so things would Just Work if you copied a disk image from an existing VM.

But I'm not the one working on management layers or guest image tools, so I will just trust Richard's and Daniel's opinions on this.

Signature · 1 line
Eduardo
#25 lore raw
In reply to Richard W.M. Jones
Quoted 11 lines · * Richard W.M. Jones ([email protected]) wrote:
Quoted 7 lines · Daniel P. Berrangé

The closest to a cross-hypervisor standard is OVF which can store metadata about required hardware for a VM. I'm pretty sure it does not have the concept of machine types, but maybe it has a way for people to define metadata extensions. Since it is just XML at the end of the day, even if there was nothing official in OVF, it would be possible to just define a custom XML namespace and declare a schema for that to follow.

I have a great deal of experience with the OVF "standard". TL;DR: DO NOT USE IT.

In addition to the detail below, from reading DMTF's OVF spec (DSP0243 v 2.1.1) I see absolutely nothing specifying hardware type. Sure it can specify size of storage, number of ether cards, MAC addresses for them etc - but I don't see any where specify the type of emualted system.

Dave

Quoted 27 lines

Long answer copied from a rant I wrote on an internal mailing list a while back:

Don't make the mistake of confusing OVF for a format. It's not, there are at least 4 non-interoperable OVF "format"s around:

- 2 x oVirt OVF
- VMware's OVF used in exported OVA files
- VirtualBox's OVF used in their exported OVA files

These are all different and do not interoperate *at all*. So before you decide "let's parse OVF", be precise about which format(s) you actually want to parse.

Also OVF is a hideous format. Many fields are obviously internal data dumps of VMware structures, complete with internal VMware IDs instead of descriptive names. Where there are descriptive names, they use English strings instead of keywords, like: <rasd:AllocationUnits>MetaBytes</> or my particular WTF favourite, a meaningful field which references English (only) Wikipedia:

<Disk ovf:format="http://en.wikipedia.org/wiki/Byte">

File references are split over two places, and there are other examples where data is needlessly duplicated or it's unclear what data is supposed to be.

Quoted 13 lines

Of course VMware Inc. are not stupid enough to use this format for their own purposes. They use a completely different format (VMX) which is a lot like YAML.

Rich.

Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#11 lore raw
In reply to Markus Armbruster
Quoted 1 line · * Markus Armbruster ([email protected]) wrote:

Seriously, though: are disk images a sane way to package software?

They're not actually terrible.
You can just start a VM with them straight away, no unpacking required, no installation time. Especially when used with something like -snapshot.
It's also easy for the person packaging them.

Dave
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#26 lore raw
In reply to Dr. David Alan Gilbert
Quoted 10 lines · Dr. David Alan Gilbert
Quoted 9 lines · * Richard W.M. Jones ([email protected]) wrote:
Quoted 7 lines · Daniel P. Berrangé

The closest to a cross-hypervisor standard is OVF which can store metadata about required hardware for a VM. I'm pretty sure it does not have the concept of machine types, but maybe it has a way for people to define metadata extensions. Since it is just XML at the end of the day, even if there was nothing official in OVF, it would be possible to just define a custom XML namespace and declare a schema for that to follow.

Quoted 8 lines
Quoted 2 lines

I have a great deal of experience with the OVF "standard". TL;DR: DO NOT USE IT.

In addition to the detail below, from reading DMTF's OVF spec (DSP0243 v 2.1.1) I see absolutely nothing specifying hardware type. Sure it can specify size of storage, number of ether cards, MAC addresses for them etc - but I don't see any where specify the type of emualted system.

Maybe the VirtualHardwareSection/System/vssd:VirtualSystemType element could be used for that. (DSP0243 v2.1.1, line 650).

But based on Richard's feedback, I think we shouldn't even try to use it.

Signature · 1 line
Eduardo
#27 lore raw
Quoted 20 lines · Eduardo Habkost
Quoted 10 lines · Dr. David Alan Gilbert
Quoted 9 lines · * Richard W.M. Jones ([email protected]) wrote:
Quoted 7 lines · Daniel P. Berrangé

The closest to a cross-hypervisor standard is OVF which can store metadata about required hardware for a VM. I'm pretty sure it does not have the concept of machine types, but maybe it has a way for people to define metadata extensions. Since it is just XML at the end of the day, even if there was nothing official in OVF, it would be possible to just define a custom XML namespace and declare a schema for that to follow.

Quoted 8 lines
Quoted 2 lines

I have a great deal of experience with the OVF "standard". TL;DR: DO NOT USE IT.

In addition to the detail below, from reading DMTF's OVF spec (DSP0243 v 2.1.1) I see absolutely nothing specifying hardware type. Sure it can specify size of storage, number of ether cards, MAC addresses for them etc - but I don't see any where specify the type of emualted system.

Quoted 5 lines

Maybe the VirtualHardwareSection/System/vssd:VirtualSystemType element could be used for that. (DSP0243 v2.1.1, line 650).

But based on Richard's feedback, I think we shouldn't even try to use it.

Yes, save yourself time and worry by avoiding OVF altogether.

Note that in any case you need something quite different from any existing metadata format. Most guests will support a variety of driver models (eg. pc or q35, sata or virtio-blk or virtio-scsi, ...).

You need to express what device drivers are installed in the guest, (separately for boot and running) and then the management layer needs to match the devices the hypervisor can emulate with the required devices, select the best performing ones in each class, and present those to the guest.

As far as I know, there is no existing metadata format which expresses this.

Rich.

Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
#28 lore raw
In reply to Eduardo Habkost
Quoted 14 lines · * Eduardo Habkost ([email protected]) wrote:
Quoted 13 lines · Dr. David Alan Gilbert
Quoted 11 lines · * Richard W.M. Jones ([email protected]) wrote:
Quoted 7 lines · Daniel P. Berrangé

The closest to a cross-hypervisor standard is OVF which can store metadata about required hardware for a VM. I'm pretty sure it does not have the concept of machine types, but maybe it has a way for people to define metadata extensions. Since it is just XML at the end of the day, even if there was nothing official in OVF, it would be possible to just define a custom XML namespace and declare a schema for that to follow.

I have a great deal of experience with the OVF "standard". TL;DR: DO NOT USE IT.

Quoted 8 lines
Quoted 5 lines

In addition to the detail below, from reading DMTF's OVF spec (DSP0243 v 2.1.1) I see absolutely nothing specifying hardware type. Sure it can specify size of storage, number of ether cards, MAC addresses for them etc - but I don't see any where specify the type of emualted system.

Maybe the VirtualHardwareSection/System/vssd:VirtualSystemType element could be used for that. (DSP0243 v2.1.1, line 650).

Ah yes, you're right; they hadn't bothered putting that in any of the examples. A quick search suggests VMWare use that as 'vmx-10' or 'vmx-12' as a 'hardware faimily'.

Quoted 2 lines

But based on Richard's feedback, I think we shouldn't even try to use it.

Right; although if we have a key/value system, then if the key/value structures we used happened to match up with OVMF if they made sense then I guess it would make conversions easy.

Dave

Quoted 2 lines
Signature · 1 line
Eduardo

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#48 lore raw
In reply to Max Reitz

<reawakening a fizzled out thread>

This seems to have fizzled out because of a lack of a concrete proposal; so here is one based on a reply to Max's post:

* Max Reitz ([email protected]) wrote:

<snip>

Quoted 8 lines

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture.

<snip>

Quoted 5 lines

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them?

<snip>

Quoted 4 lines

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

<snip>

Quoted 8 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would think (which may
support JSON at some point?). So basically we would store the data as
a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files. I hate the idea of making qcow2 a random archive format. We have tar for that.

<snip>

Quoted 3 lines

tl;dr: I really don't get why it's so hard to supply a config file along with a qcow2 image. Is it so hard for people to realize that a VM does not only consist of a disk?

Yes! Because in many cases that's all it needs, and it's ready to run with no unpacking.

I think we should have:

--------------------------------------------------------------
Layer 0:
QCOW provides a way to store a single string of arbitrary (but
limited?) length.
QCOW provides a way to replace the string by a new string. The original or the new string will be stored after that; never some mix.
Where a file 'b' has a backing file 'a', 'b' inherits the string from 'a' unless 'b' has it's own string. Snapshots inherit their string from the main unless they have their own string.

Layer 1:
The string shall always be a JSON 'object'; i.e. of the form

    { "something": ... , "more": ... }

The key strings shall be non-null and non-empty and shall be unique.

Layer 2:
'.'s in the key string shall indicate hierarchy

Key strings shall be listed in qemu's
docs/specs/qcow-keys.rst

that shall indicate their meaning and the meaning and valid formatting of the value associated with the,

Key strings shall start with either:
qemu. in which case they must be listed in a file in
the qemu source tree

a reverse dotted name unique to the submitter, they may
be listed in the same file in the source tree, e.g.
com.redhat.

Layer 3:
QEMU shall, for a given qcow2 file be able to dump the key values.

Layer 4:
On creating a VM by importing a qcow2, a management layer shall inspect the key/values to influence the configuration
of the VM created. Where it imports multiple qcow2's it
shall inspect all the files and flag disagreements.

Management layers shall, on creating a qcow2 shall set the keys based on the VM the qcow2 is created for. If the qcow2 is created as an additional disk for an exisitng VM it's fine to leave the string empty (e.g. for a data disk).

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.
b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.
(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

"qemu.machine-types": [ "q35", "i440fx" ]
"qemu.min-ram-MB": 1024

Dave

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#49 lore raw
Quoted 67 lines · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

This seems to have fizzled out because of a lack of a concrete proposal; so here is one based on a reply to Max's post:

* Max Reitz ([email protected]) wrote:

<snip>

Quoted 8 lines

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture.

<snip>

Quoted 5 lines

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them?

<snip>

Quoted 4 lines

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

<snip>

Quoted 8 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would think (which may
support JSON at some point?). So basically we would store the data as
a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files. I hate the idea of making qcow2 a random archive format. We have tar for that.

<snip>

Quoted 3 lines

tl;dr: I really don't get why it's so hard to supply a config file along with a qcow2 image. Is it so hard for people to realize that a VM does not only consist of a disk?

Yes! Because in many cases that's all it needs, and it's ready to run with no unpacking.

I think we should have:

--------------------------------------------------------------
Layer 0:
QCOW provides a way to store a single string of arbitrary (but
limited?) length.
QCOW provides a way to replace the string by a new string. The original or the new string will be stored after that; never some mix.
Where a file 'b' has a backing file 'a', 'b' inherits the string from 'a' unless 'b' has it's own string. Snapshots inherit their string from the main unless they have their own string.

Quoted 7 lines

Layer 1:
The string shall always be a JSON 'object'; i.e. of the form

    { "something": ... , "more": ... }

The key strings shall be non-null and non-empty and shall be unique.

I'd prefer layer 0+1 to:

1) Allow multiple entries to be stored (implemented by layer 1 in this proposal)
2) Identify each entry with a name (implemented by layer 1 in this proposal)
3) Allow arbitrary binary data to be stored on an entry (not possible with the JSON-based proposal, because JSON strings are not blobs, but Unicode strings).
4) Make it easy to replace only one entry while keeping others intact (not the case here, if all entries are stored in the same JSON string)

I think it would be simpler if layer 0 simply provided a list of names/value pairs, where names are ascii strings, and values are binary data[1]. It would make layer 1 unnecessary, and allow (3) and (4) to happen.

[1] In other words, Rich's proposal of "named blobs":
https://www.mail-archive.com/[email protected]/msg37856.html

Quoted 9 lines

Layer 2:
'.'s in the key string shall indicate hierarchy

Key strings shall be listed in qemu's
docs/specs/qcow-keys.rst

that shall indicate their meaning and the meaning and valid formatting of the value associated with the,

Quoted 8 lines

Key strings shall start with either:
qemu. in which case they must be listed in a file in
the qemu source tree

a reverse dotted name unique to the submitter, they may
be listed in the same file in the source tree, e.g.
com.redhat.

Based on this proposal for layer 2, it looks like you expect the number of keys used on layer 1 to become large.

I would prefer a solution that expects a very small set of keys for layer 0+1, and point to other specifications of how the blob can be interpreted for each key. This way we can experiment with different solutions for layers 2-4, instead of deciding on a specific format like JSON.

Quoted 43 lines

Layer 3:
QEMU shall, for a given qcow2 file be able to dump the key values.

Layer 4:
On creating a VM by importing a qcow2, a management layer shall inspect the key/values to influence the configuration
of the VM created. Where it imports multiple qcow2's it
shall inspect all the files and flag disagreements.

Management layers shall, on creating a qcow2 shall set the keys based on the VM the qcow2 is created for. If the qcow2 is created as an additional disk for an exisitng VM it's fine to leave the string empty (e.g. for a data disk).

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.
b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.
(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024

Dave

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

Signature · 1 line
Eduardo
#50 lore raw
Quoted 89 lines · Eduardo Habkost
Quoted 67 lines · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

This seems to have fizzled out because of a lack of a concrete proposal; so here is one based on a reply to Max's post:

* Max Reitz ([email protected]) wrote:

<snip>

Quoted 8 lines

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture.

<snip>

Quoted 5 lines

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them?

<snip>

Quoted 4 lines

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

<snip>

Quoted 8 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would think (which may
support JSON at some point?). So basically we would store the data as
a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files. I hate the idea of making qcow2 a random archive format. We have tar for that.

<snip>

Quoted 3 lines

tl;dr: I really don't get why it's so hard to supply a config file along with a qcow2 image. Is it so hard for people to realize that a VM does not only consist of a disk?

Yes! Because in many cases that's all it needs, and it's ready to run with no unpacking.

I think we should have:

--------------------------------------------------------------
Layer 0:
QCOW provides a way to store a single string of arbitrary (but
limited?) length.
QCOW provides a way to replace the string by a new string. The original or the new string will be stored after that; never some mix.
Where a file 'b' has a backing file 'a', 'b' inherits the string from 'a' unless 'b' has it's own string. Snapshots inherit their string from the main unless they have their own string.

Quoted 7 lines

Layer 1:
The string shall always be a JSON 'object'; i.e. of the form

    { "something": ... , "more": ... }

The key strings shall be non-null and non-empty and shall be unique.

I'd prefer layer 0+1 to:

1) Allow multiple entries to be stored (implemented by layer 1 in this proposal)
2) Identify each entry with a name (implemented by layer 1 in this proposal)
3) Allow arbitrary binary data to be stored on an entry (not possible with the JSON-based proposal, because JSON strings are not blobs, but Unicode strings).
4) Make it easy to replace only one entry while keeping others intact (not the case here, if all entries are stored in the same JSON string)

Quoted 7 lines

I think it would be simpler if layer 0 simply provided a list of names/value pairs, where names are ascii strings, and values are binary data[1]. It would make layer 1 unnecessary, and allow (3) and (4) to happen.

[1] In other words, Rich's proposal of "named blobs":
https://www.mail-archive.com/[email protected]/msg37856.html

I think simple is beautiful, too. But assuming they really are binary how are blobs encoded? Did binary really mean UTF-8 here?

Quoted 75 lines
Quoted 10 lines

Layer 2:
'.'s in the key string shall indicate hierarchy

Key strings shall be listed in qemu's
docs/specs/qcow-keys.rst

that shall indicate their meaning and the meaning and valid formatting of the value associated with the,

Quoted 8 lines

Key strings shall start with either:
qemu. in which case they must be listed in a file in
the qemu source tree

a reverse dotted name unique to the submitter, they may
be listed in the same file in the source tree, e.g.
com.redhat.

Based on this proposal for layer 2, it looks like you expect the number of keys used on layer 1 to become large.

I would prefer a solution that expects a very small set of keys for layer 0+1, and point to other specifications of how the blob can be interpreted for each key. This way we can experiment with different solutions for layers 2-4, instead of deciding on a specific format like JSON.

Quoted 43 lines

Layer 3:
QEMU shall, for a given qcow2 file be able to dump the key values.

Layer 4:
On creating a VM by importing a qcow2, a management layer shall inspect the key/values to influence the configuration
of the VM created. Where it imports multiple qcow2's it
shall inspect all the files and flag disagreements.

Management layers shall, on creating a qcow2 shall set the keys based on the VM the qcow2 is created for. If the qcow2 is created as an additional disk for an exisitng VM it's fine to leave the string empty (e.g. for a data disk).

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.
b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.
(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024

Dave

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

Signature · 1 line
Eduardo
#51 lore raw
Quoted 13 lines · Michael S. Tsirkin
Quoted 13 lines
Quoted 6 lines

Layer 1:
The string shall always be a JSON 'object'; i.e. of the form
{ "something": ... , "more": ... }

The key strings shall be non-null and non-empty and shall be unique.

I think it would be simpler if layer 0 simply provided a list of names/value pairs, where names are ascii strings, and values are binary data[1]. It would make layer 1 unnecessary, and allow (3) and (4) to happen.

Quoted 6 lines
Quoted 2 lines

[1] In other words, Rich's proposal of "named blobs":
https://www.mail-archive.com/[email protected]/msg37856.html

I think simple is beautiful, too. But assuming they really are binary how are blobs encoded? Did binary really mean UTF-8 here?

Binary blobs can always be base64 encoded for representation within a valid JSON UTF-8 string (and we already have several QMP interfaces that utilize base64 encoding to pass through what is otherwise invalid UTF-8). It does inflate things slightly compared to a format that allows a raw length coupled with raw data, but that is not necessarily a problem.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#52 lore raw
Quoted 15 lines · Eric Blake
Quoted 13 lines · Michael S. Tsirkin
Quoted 13 lines
Quoted 6 lines

Layer 1:
The string shall always be a JSON 'object'; i.e. of the form

    { "something": ... , "more": ... }

The key strings shall be non-null and non-empty and shall be unique.

I think it would be simpler if layer 0 simply provided a list of names/value pairs, where names are ascii strings, and values are binary data[1]. It would make layer 1 unnecessary, and allow (3) and (4) to happen.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

[1] In other words, Rich's proposal of "named blobs":
https://www.mail-archive.com/[email protected]/msg37856.html

I think simple is beautiful, too. But assuming they really are binary how are blobs encoded? Did binary really mean UTF-8 here?

By binary I actually meant binary. The idea is you could store things like PNG images in them (for icons).

Quoted 6 lines

Binary blobs can always be base64 encoded for representation within a valid JSON UTF-8 string (and we already have several QMP interfaces that utilize base64 encoding to pass through what is otherwise invalid UTF-8). It does inflate things slightly compared to a format that allows a raw length coupled with raw data, but that is not necessarily a problem.

Of course how we represent them externally and/or while using QMP / qemu-img to store and retrieve them is up for grabs. Doesn't JSON allow binary to be encoded? (Knowing how poorly done JSON is, I wouldn't be surprised if not)

Rich.

Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
#59 lore raw
In reply to Eric Blake
Quoted 22 lines · Eric Blake
Quoted 13 lines · Michael S. Tsirkin
Quoted 13 lines
Quoted 6 lines

Layer 1:
The string shall always be a JSON 'object'; i.e. of the form
{ "something": ... , "more": ... }

The key strings shall be non-null and non-empty and shall be unique.

I think it would be simpler if layer 0 simply provided a list of names/value pairs, where names are ascii strings, and values are binary data[1]. It would make layer 1 unnecessary, and allow (3) and (4) to happen.

Quoted 6 lines
Quoted 2 lines

[1] In other words, Rich's proposal of "named blobs":
https://www.mail-archive.com/[email protected]/msg37856.html

I think simple is beautiful, too. But assuming they really are binary how are blobs encoded? Did binary really mean UTF-8 here?

Quoted 5 lines

Binary blobs can always be base64 encoded for representation within a valid JSON UTF-8 string (and we already have several QMP interfaces that utilize base64 encoding to pass through what is otherwise invalid UTF-8). It does inflate things slightly compared to a format that allows a raw length coupled with raw data, but that is not necessarily a problem.

OK so what's proposed here is something like the following:

[A-Za-z][^=\0]*=[^\0]*

Sound reasonable?

How about a fixed key at the beginning to specify the format?

E.g. 16 first bytes:

qcow2-format=00\0

anything else in first 16 bytes means some other format?

Quoted 4 lines
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#53 lore raw
In reply to Richard W.M. Jones
Quoted 11 lines · Richard W.M. Jones
Quoted 6 lines

Binary blobs can always be base64 encoded for representation within a valid JSON UTF-8 string (and we already have several QMP interfaces that utilize base64 encoding to pass through what is otherwise invalid UTF-8). It does inflate things slightly compared to a format that allows a raw length coupled with raw data, but that is not necessarily a problem.

Of course how we represent them externally and/or while using QMP / qemu-img to store and retrieve them is up for grabs. Doesn't JSON allow binary to be encoded? (Knowing how poorly done JSON is, I wouldn't be surprised if not)

JSON itself does not have a binary primitive; to pass arbitrary data through JSON you have to first encode that data into something like base64 that can then be represented as a UTF-8 string. For reference, look at qapi/crypto.json and the definition of QCryptoSecretFormat.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#54 lore raw
Quoted 13 lines · Eric Blake
Quoted 11 lines · Richard W.M. Jones
Quoted 6 lines

Binary blobs can always be base64 encoded for representation within a valid JSON UTF-8 string (and we already have several QMP interfaces that utilize base64 encoding to pass through what is otherwise invalid UTF-8). It does inflate things slightly compared to a format that allows a raw length coupled with raw data, but that is not necessarily a problem.

Of course how we represent them externally and/or while using QMP / qemu-img to store and retrieve them is up for grabs. Doesn't JSON allow binary to be encoded? (Knowing how poorly done JSON is, I wouldn't be surprised if not)

Quoted 4 lines

JSON itself does not have a binary primitive; to pass arbitrary data through JSON you have to first encode that data into something like base64 that can then be represented as a UTF-8 string. For reference, look at qapi/crypto.json and the definition of QCryptoSecretFormat.

But there isn't a way to figure out that a string is base64, which means each application needs to know whether it's a string or a binary.

How about specifying the encoding in the value?

string value:
[A-Za-z][^=\0]=S[^\0]*

base64 value:
[A-Za-z][^=\0]=B[A-Za-z0-9+/]*

or the key:
S[A-Za-z][^=\0]=[^\0]*

base64 value:
B[A-Za-z][^=\0]=[A-Za-z0-9+/]*

?

Signature · 1 line
MST
#55 lore raw
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Eric Blake
Quoted 11 lines · Richard W.M. Jones
Quoted 6 lines

Binary blobs can always be base64 encoded for representation within a valid JSON UTF-8 string (and we already have several QMP interfaces that utilize base64 encoding to pass through what is otherwise invalid UTF-8). It does inflate things slightly compared to a format that allows a raw length coupled with raw data, but that is not necessarily a problem.

Of course how we represent them externally and/or while using QMP / qemu-img to store and retrieve them is up for grabs. Doesn't JSON allow binary to be encoded? (Knowing how poorly done JSON is, I wouldn't be surprised if not)

Quoted 8 lines
Quoted 4 lines

JSON itself does not have a binary primitive; to pass arbitrary data through JSON you have to first encode that data into something like base64 that can then be represented as a UTF-8 string. For reference, look at qapi/crypto.json and the definition of QCryptoSecretFormat.

But there isn't a way to figure out that a string is base64, which means each application needs to know whether it's a string or a binary.

Other than if the key name is well-known (and interpretation of the value is done according to the key, if it is interpreted at all).

Quoted 6 lines

How about specifying the encoding in the value?

string value:
[A-Za-z][^=\0]=S[^\0]*

Quoted 8 lines

base64 value:
[A-Za-z][^=\0]=B[A-Za-z0-9+/]*

or the key:
S[A-Za-z][^=\0]=[^\0]*

base64 value:
B[A-Za-z][^=\0]=[A-Za-z0-9+/]*

If we're going to express a tuple of <key,type,value>, then let's describe it as a 3-tuple, rather than trying to overload that into a 2-tuple key=value syntax. After all, while you may want a high-level layer 1 representation in JSON or something else easy to hand off to other processing, there's no requirement that the layer 0 storage in qcow2 can't be a struct in some other layout, even if we have to convert between layouts for what is stored in the file vs. what is presented to the user.

By that argument, a single JSON object (if we insist on storing a single JSON object as layer 0) might be:

[ { "name": "foo", "type": "raw", "value": "bar" },
{ "name": "quux", "type": "base64", "value": "aGVsbG8=" } ]

But figuring out how to add a "Header extension type" to docs/interop/qcow2.txt, and whether the key/value payload will usefully fit in that header extension (where we are tight on spacing, as ALL extensions combined must fit in a single cluster), or whether the header should instead have an offset field that points to some other cluster in the qcow2 image, is relatively straightforward, and relatively independent of the even bigger design question of whether we want to allow qcow2 as an image format to expose an arbitrary data store feature and what types of data should go into that store.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#56 lore raw
Quoted 39 lines · Eric Blake
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Eric Blake
Quoted 11 lines · Richard W.M. Jones
Quoted 6 lines

Binary blobs can always be base64 encoded for representation within a valid JSON UTF-8 string (and we already have several QMP interfaces that utilize base64 encoding to pass through what is otherwise invalid UTF-8). It does inflate things slightly compared to a format that allows a raw length coupled with raw data, but that is not necessarily a problem.

Of course how we represent them externally and/or while using QMP / qemu-img to store and retrieve them is up for grabs. Doesn't JSON allow binary to be encoded? (Knowing how poorly done JSON is, I wouldn't be surprised if not)

Quoted 8 lines
Quoted 4 lines

JSON itself does not have a binary primitive; to pass arbitrary data through JSON you have to first encode that data into something like base64 that can then be represented as a UTF-8 string. For reference, look at qapi/crypto.json and the definition of QCryptoSecretFormat.

But there isn't a way to figure out that a string is base64, which means each application needs to know whether it's a string or a binary.

Other than if the key name is well-known (and interpretation of the value is done according to the key, if it is interpreted at all).

Quoted 12 lines

How about specifying the encoding in the value?

string value:
[A-Za-z][^=\0]=S[^\0]*

base64 value:
[A-Za-z][^=\0]=B[A-Za-z0-9+/]*

or the key:
S[A-Za-z][^=\0]=[^\0]*

Quoted 6 lines
Quoted 2 lines

base64 value:
B[A-Za-z][^=\0]=[A-Za-z0-9+/]*

If we're going to express a tuple of <key,type,value>, then let's describe it as a 3-tuple, rather than trying to overload that into a 2-tuple key=value syntax.

It's a 3 tuple, isn't it?

Foobar=Sabc
1------23

"=" marks end of key but we don't have so many types to need a separator between type and value. Would you prefer:

Foobar=S:abc

then, just in case we add a huge number of types down the road?

Quoted 7 lines

After all, while you may want a high-level layer 1
representation in JSON or something else easy to hand off to other processing, there's no requirement that the layer 0 storage in qcow2 can't be a struct in some other layout, even if we have to convert between layouts for what is stored in the file vs. what is presented to the user.

Quoted 5 lines

By that argument, a single JSON object (if we insist on storing a single JSON object as layer 0) might be:

[ { "name": "foo", "type": "raw", "value": "bar" },
{ "name": "quux", "type": "base64", "value": "aGVsbG8=" } ]

I suspect a lot of what we might want to save would be snippets from QEMU command line, which are all 0-terminated strings but for which there is no guarantee they are valid JSON or even UTF8 strings.

We could base64 encode them all but that means some of json advantages (e.g. readability) are gone, and it will be easy for us to get confused and forget to encode some string which will lead to security issues. I'd rather use a format that allows zero terminated strings as 1st class citizens.

Quoted 5 lines

But figuring out how to add a "Header extension type" to docs/interop/qcow2.txt, and whether the key/value payload will usefully fit in that header extension (where we are tight on spacing, as ALL extensions combined must fit in a single cluster), or whether the header should instead have an offset field that points to some other cluster in the qcow2 image,

I'm guessing we need an offset, yes.

Quoted 4 lines

is relatively straightforward, and relatively independent of the even bigger design question of whether we want to allow qcow2 as an image format to expose an arbitrary data store feature and what types of data should go into that store.

I agree it can be decided later but it's not orthogonal in that it only makes sense to argue what exactly we store there after we have the capability to store *something* :)

I think we can start small and define the format first, extend qemu-img
- either get/set the file so we can pipe it to some other utility, or teach it to work with keys/values directly.

Next step will be to start defining contents. We already have two things I know we want to store: the architecture and the machine type are useful for bootable images.

Poking at these values from qemu and warning user on mismatch, or even getting the default machine from there if not specified might be a step after that.

Quoted 4 lines
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#12 lore raw
In reply to Markus Armbruster
Quoted 11 lines · On Wed, 23 May 2018 18:35:31 +0200 Markus Armbruster <[email protected]> wrote:
Quoted 9 lines · Eduardo Habkost
Quoted 8 lines · Markus Armbruster
Quoted 6 lines · Eduardo Habkost
Quoted 4 lines · Daniel P. Berrangé
Quoted 2 lines · Eduardo Habkost

On Sat, May 19, 2018 at 08:05:06AM +0200, Markus Armbruster wrote:

...

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 7 lines
Quoted 6 lines

The point here is to allow users to simply copy an existing disk image, and it will contain enough hints for a cloud stack to choose reasonable defaults for machine-type and disk type automatically. Requiring the user to perform a separate step to encapsulate the disk image in another file format defeats the whole purpose of the proposal.

Quoted 7 lines

It doesn't have to mean more work for the user - the application that is used to create the image can do that on their behalf. oVirt for example can import/export OVA files, containing OVF metadata. I could imagine virt-manager, and other tools adding export ability without much trouble if this was deemed a desirable thing. Bundling gives ability to have multiple disk images in one archive, which is something OVF does.

I have the impression that "the application that is used to create the image" is a very large set. It can be virt-manager, virt-install, virt-manager, or even QEMU itself.

Today people can simply create a VM on virt-manager, or run QEMU manually, and upload the qcow2 image directly from its original location (they don't need to copy/export it). Don't we want the same procedure to keep working instead of requiring users to use another tool?

...

Quoted 13 lines
Quoted 4 lines
Quoted 3 lines

With OVF, you solve the problem further up the stack: you do virtual appliances instead of disk images.

Quoted 8 lines

I guess the main problem is that people are already using disk images as if they were virtual appliances.

We can tell people to stop doing that and use OVF, but then we won't make anybody's life any easier: publishers of images might need to generate both qcow2 and OVF images if they want it to work with older hosts; consumers will need to find out if they need qcow2 or OVF.

Quoted 4 lines

I'm afraid providing for "hints" in QCOW2 could only add problems. To pick the right hints, publishers need to predict how future software consuming the image will interpret them. Consumers may have to configure their software to interpret hints in various ways.

That depends on the hint.

If you define that the key libvirt-xml contains the libvirt machine definition it is up to libvirt to define what exactly the hint contains.

It allows exporting a machine from virt-manager or virsh and importing into same with exact same properties. Looking at it will probably give you some idea how to configure the VM in another virtualization solution.

Similarly OpenStack can define different hint for OpenStack VMs.

You are free to equip you appliance with multiple hints if you want it to work it on multiple virtualization solutions. It is much more efficient than providing multiple appliance images that embed the same disk image and different metadata. Virtualization solutions are free to implement conversions to ease importing VMs from different source, even for something as horrible as OVF.

It is a bit limiting, though.

You cannot make an applicance with multiple disks when the metadata is embedded in a disk image.

Thanks

Michal

#58 lore raw
In reply to Richard W.M. Jones

Hi,

Quoted 2 lines

By binary I actually meant binary. The idea is you could store things like PNG images in them (for icons).

Guess if we go that route we also want store a mine-type for each entry.

cheers,
Gerd

#60 lore raw
In reply to Eduardo Habkost

Hi,

Quoted 8 lines

Based on this proposal for layer 2, it looks like you expect the number of keys used on layer 1 to become large.

I would prefer a solution that expects a very small set of keys for layer 0+1, and point to other specifications of how the blob can be interpreted for each key. This way we can experiment with different solutions for layers 2-4, instead of deciding on a specific format like JSON.

Well, you never know what people will use this for ...

cheers,
Gerd

#57 lore raw
In reply to Michael S. Tsirkin
Quoted 28 lines · * Michael S. Tsirkin ([email protected]) wrote:
Quoted 13 lines · Eric Blake
Quoted 11 lines · Richard W.M. Jones
Quoted 6 lines

Binary blobs can always be base64 encoded for representation within a valid JSON UTF-8 string (and we already have several QMP interfaces that utilize base64 encoding to pass through what is otherwise invalid UTF-8). It does inflate things slightly compared to a format that allows a raw length coupled with raw data, but that is not necessarily a problem.

Of course how we represent them externally and/or while using QMP / qemu-img to store and retrieve them is up for grabs. Doesn't JSON allow binary to be encoded? (Knowing how poorly done JSON is, I wouldn't be surprised if not)

Quoted 4 lines

JSON itself does not have a binary primitive; to pass arbitrary data through JSON you have to first encode that data into something like base64 that can then be represented as a UTF-8 string. For reference, look at qapi/crypto.json and the definition of QCryptoSecretFormat.

But there isn't a way to figure out that a string is base64, which means each application needs to know whether it's a string or a binary.

How about specifying the encoding in the value?

string value:
[A-Za-z][^=\0]=S[^\0]*

Quoted 8 lines

base64 value:
[A-Za-z][^=\0]=B[A-Za-z0-9+/]*

or the key:
S[A-Za-z][^=\0]=[^\0]*

base64 value:
B[A-Za-z][^=\0]=[A-Za-z0-9+/]*

Why reinvent the wheel yet again?
The world has enough encodings out there, and we're trying to add something that's a trivial data store for a frankly trivial use.

While I hate json, it's at least standard.

Dave

Quoted 4 lines

?

Signature · 1 line
MST

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#61 lore raw
In reply to Eduardo Habkost
Quoted 89 lines · * Eduardo Habkost ([email protected]) wrote:
Quoted 67 lines · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

This seems to have fizzled out because of a lack of a concrete proposal; so here is one based on a reply to Max's post:

* Max Reitz ([email protected]) wrote:

<snip>

Quoted 8 lines

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture.

<snip>

Quoted 5 lines

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them?

<snip>

Quoted 4 lines

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

<snip>

Quoted 8 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would think (which may
support JSON at some point?). So basically we would store the data as
a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files. I hate the idea of making qcow2 a random archive format. We have tar for that.

<snip>

Quoted 3 lines

tl;dr: I really don't get why it's so hard to supply a config file along with a qcow2 image. Is it so hard for people to realize that a VM does not only consist of a disk?

Yes! Because in many cases that's all it needs, and it's ready to run with no unpacking.

I think we should have:

--------------------------------------------------------------
Layer 0:
QCOW provides a way to store a single string of arbitrary (but
limited?) length.
QCOW provides a way to replace the string by a new string. The original or the new string will be stored after that; never some mix.
Where a file 'b' has a backing file 'a', 'b' inherits the string from 'a' unless 'b' has it's own string. Snapshots inherit their string from the main unless they have their own string.

Quoted 7 lines

Layer 1:
The string shall always be a JSON 'object'; i.e. of the form

    { "something": ... , "more": ... }

The key strings shall be non-null and non-empty and shall be unique.

I'd prefer layer 0+1 to:

1) Allow multiple entries to be stored (implemented by layer 1 in this proposal)
2) Identify each entry with a name (implemented by layer 1 in this proposal)
3) Allow arbitrary binary data to be stored on an entry (not possible with the JSON-based proposal, because JSON strings are not blobs, but Unicode strings).
4) Make it easy to replace only one entry while keeping others intact (not the case here, if all entries are stored in the same JSON string)

Quoted 7 lines

I think it would be simpler if layer 0 simply provided a list of names/value pairs, where names are ascii strings, and values are binary data[1]. It would make layer 1 unnecessary, and allow (3) and (4) to happen.

[1] In other words, Rich's proposal of "named blobs":
https://www.mail-archive.com/[email protected]/msg37856.html

My reasoning was just one of simplicity; each layer in this is almost trivial.
The downside to my proposal is it's more expensive if you want to change a single key; but as yet no one has suggested why we'd want to do it frequently enough to worry.

My suggestion of JSON was just to try and stop the bikeshedding; we seem to be putting a lot of effort into inventing a new storage definition for something that so far we need to hold one rarely changing short string, which even with all the discussion has moved upto maybe 3 or 4 rarely changing pieces of data.

Dave

Quoted 68 lines
Quoted 11 lines

Layer 2:
'.'s in the key string shall indicate hierarchy

Key strings shall be listed in qemu's
docs/specs/qcow-keys.rst

that shall indicate their meaning and the meaning and valid formatting of the value associated with the,

Quoted 8 lines

Key strings shall start with either:
qemu. in which case they must be listed in a file in
the qemu source tree

a reverse dotted name unique to the submitter, they may
be listed in the same file in the source tree, e.g.
com.redhat.

Based on this proposal for layer 2, it looks like you expect the number of keys used on layer 1 to become large.

I would prefer a solution that expects a very small set of keys for layer 0+1, and point to other specifications of how the blob can be interpreted for each key. This way we can experiment with different solutions for layers 2-4, instead of deciding on a specific format like JSON.

Quoted 38 lines

Layer 3:
QEMU shall, for a given qcow2 file be able to dump the key values.

Layer 4:
On creating a VM by importing a qcow2, a management layer shall inspect the key/values to influence the configuration
of the VM created. Where it imports multiple qcow2's it
shall inspect all the files and flag disagreements.

Management layers shall, on creating a qcow2 shall set the keys based on the VM the qcow2 is created for. If the qcow2 is created as an additional disk for an exisitng VM it's fine to leave the string empty (e.g. for a data disk).

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.
b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.
(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024
Quoted 8 lines
Quoted 5 lines

Dave

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

Signature · 1 line
Eduardo

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#114 lore raw
In reply to Max Reitz
Quoted 110 lines · On Tue, 29 May 2018 12:14:15 +0200 Max Reitz <[email protected]> wrote:
Quoted 28 lines · Kevin Wolf

Am 28.05.2018 um 23:25 hat Richard W.M. Jones geschrieben:

Quoted 18 lines
Quoted 16 lines · Richard W.M. Jones
Quoted 6 lines · Kevin Wolf

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

We do this already in virt-v2v (using file.offset and file.size parameters in the raw driver).

For virt-v2v we only need to read the source so resizing isn't an issue. For most of the cases we're talking about the downloaded image would also be a template / base image, so I suppose only reading would be required too.

Quoted 8 lines
Quoted 3 lines

I also wrote an nbdkit tar file driver (supports writes, but not resizing).
https://manpages.debian.org/testing/nbdkit-plugin-perl/nbdkit-tar-plugin.1.en.html

I should add the other thorny issue with OVA files is that the metadata contains a checksum (SHA1 or SHA256) of the disk images. If you modify the disk images in-place in the tar file then you need to recalculate those.

Quoted 7 lines

All of this means that OVA isn't really well suited to be used as a native format for VM configuration + images. It's just for sharing read-only images that are converted into another native format before they are used.

Which is probably fair for the use case it was made for, but means that we need something else to solve our problem.

Maybe we should first narrow down our problem. Maybe you have done that already, but I'm quite in the dark still.

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture. Once we support configuring qemu solely through QMP, sure, you can do a blockdev-add and then build the machine accordingly. But that is not here today, and I'm not sure this is a good idea either, because that would mean automagic defaults for the machine-building QMP commands derived from the blockdev-add earlier, which should get a plain "No". Also, having to use QMP to build your machine wouldn't make anything easier; at least not easier than just supplying a configuration file along with the image.

(Building the magic into -blockdev might be less horrible, but such magic (adding block devices influences machine defaults) to me still doesn't seem worth not having to supply a config file along with the disk image.)

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them? But some of those images may only contain data and might be intended to be shared between multiple VMs. So those shouldn't receive the mark. Only disks with binaries should receive them. But what if those binaries are just cross-compiled binaries for some other VM? Oh no, so not even binaries are a sure indicator... So I have no idea where the information is supposed to be stored. In any case, "the first image" just gets an outright "no" from me, and "all images" gets an "I don't think this is a good idea".

Loading is fun, too. OK, so you attach multiple disk images to a VM. Oops, they have varying machine type information... Now what? Use the information from the first one? Definitely no. Just ignore all of the information in such a case and have the user supply the machine type again? Possible, but it seems weird to me that qemu would usually guess the machine type, but once you attach some random other image to it, it suddenly fails to do that. But maybe it's just me who thinks this is weird.

OK, so let's go a step further. We have stored the machine type information in order to not have to supply a config file with the qcow2 image -- because if we did, it could just contain the machine type and that would be it.

So to me it follows naturally that just storing the machine type doesn't make much sense if we cannot also store more VM configuration in a qcow2 file, because I don't see why you should be able to ship an image without a config file only if all you need to supply is a machine type. Often, you also need to supply how much memory the VM needs (which depends on the OS on the image) or what storage controller to use (does the OS have virtio drivers? (to be fair, it usually does, because you're supplying a VM image in the first place)).

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

For one thing, I suspect it to get really ugly implementation-wise. Getting the machine type out of a disk image and actually interpreting it automatically is bad enough, but getting possibly everything out of it? It's not going to be any better.

Quoted 7 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would think
(which may support JSON at some point?). So basically we would
store the data as a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files.

Yes, I wonder. Why did you?

Quoted 1 line

I hate the idea of making qcow2 a random archive format.

What's wrong with that?

Quoted 1 line

We have tar for that.

It does not support expanding the stored files.

Quoted 6 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into
(1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Thanks

Michal

#115 lore raw
Quoted 121 lines · Michal Suchánek
Quoted 110 lines · On Tue, 29 May 2018 12:14:15 +0200 Max Reitz <[email protected]> wrote:
Quoted 28 lines · Kevin Wolf

Am 28.05.2018 um 23:25 hat Richard W.M. Jones geschrieben:

Quoted 18 lines
Quoted 16 lines · Richard W.M. Jones
Quoted 6 lines · Kevin Wolf

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

We do this already in virt-v2v (using file.offset and file.size parameters in the raw driver).

For virt-v2v we only need to read the source so resizing isn't an issue. For most of the cases we're talking about the downloaded image would also be a template / base image, so I suppose only reading would be required too.

Quoted 8 lines
Quoted 3 lines

I also wrote an nbdkit tar file driver (supports writes, but not resizing).
https://manpages.debian.org/testing/nbdkit-plugin-perl/nbdkit-tar-plugin.1.en.html

I should add the other thorny issue with OVA files is that the metadata contains a checksum (SHA1 or SHA256) of the disk images. If you modify the disk images in-place in the tar file then you need to recalculate those.

Quoted 7 lines

All of this means that OVA isn't really well suited to be used as a native format for VM configuration + images. It's just for sharing read-only images that are converted into another native format before they are used.

Which is probably fair for the use case it was made for, but means that we need something else to solve our problem.

Maybe we should first narrow down our problem. Maybe you have done that already, but I'm quite in the dark still.

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture. Once we support configuring qemu solely through QMP, sure, you can do a blockdev-add and then build the machine accordingly. But that is not here today, and I'm not sure this is a good idea either, because that would mean automagic defaults for the machine-building QMP commands derived from the blockdev-add earlier, which should get a plain "No". Also, having to use QMP to build your machine wouldn't make anything easier; at least not easier than just supplying a configuration file along with the image.

(Building the magic into -blockdev might be less horrible, but such magic (adding block devices influences machine defaults) to me still doesn't seem worth not having to supply a config file along with the disk image.)

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them? But some of those images may only contain data and might be intended to be shared between multiple VMs. So those shouldn't receive the mark. Only disks with binaries should receive them. But what if those binaries are just cross-compiled binaries for some other VM? Oh no, so not even binaries are a sure indicator... So I have no idea where the information is supposed to be stored. In any case, "the first image" just gets an outright "no" from me, and "all images" gets an "I don't think this is a good idea".

Loading is fun, too. OK, so you attach multiple disk images to a VM. Oops, they have varying machine type information... Now what? Use the information from the first one? Definitely no. Just ignore all of the information in such a case and have the user supply the machine type again? Possible, but it seems weird to me that qemu would usually guess the machine type, but once you attach some random other image to it, it suddenly fails to do that. But maybe it's just me who thinks this is weird.

OK, so let's go a step further. We have stored the machine type information in order to not have to supply a config file with the qcow2 image -- because if we did, it could just contain the machine type and that would be it.

So to me it follows naturally that just storing the machine type doesn't make much sense if we cannot also store more VM configuration in a qcow2 file, because I don't see why you should be able to ship an image without a config file only if all you need to supply is a machine type. Often, you also need to supply how much memory the VM needs (which depends on the OS on the image) or what storage controller to use (does the OS have virtio drivers? (to be fair, it usually does, because you're supplying a VM image in the first place)).

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

For one thing, I suspect it to get really ugly implementation-wise. Getting the machine type out of a disk image and actually interpreting it automatically is bad enough, but getting possibly everything out of it? It's not going to be any better.

Quoted 7 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would think
(which may support JSON at some point?). So basically we would
store the data as a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files.

Quoted 1 line

Yes, I wonder. Why did you?

That was mostly directed at Kevin.

My reasoning was that a qcow2 file is a disk image. All data stored therein should be immediately associated with the stored data. Another reason was that from the perspective of qcow2 you don't lose anything by tying the bitmaps directly to that data; all we lost was the capability of storing bitmaps for unrelated raw files.

(And the reasoning for that is "if you want features, use qcow2" -- although R/W backing files may loosen that phrase.)

Quoted 3 lines
Quoted 1 line

I hate the idea of making qcow2 a random archive format.

What's wrong with that?

The fact that qcow2 isn't.

From my perspective it would increase the format's complexity to a point where you could just create a new format altogether. Well, actually, all you do is design a filesystem (or reuse an existing one).

Quoted 3 lines
Quoted 1 line

We have tar for that.

It does not support expanding the stored files.

Nor does qcow2, because it does not support storing files at all.

Secondly, that completely depends on how you use it. You can freely expand the last file in the archive, for instance. Also I've seen people store files in chunks so they can indeed resize it.

(I'm wondering if we could write a block driver that could provide such a chunk allocation transparently to qcow2... Note that a qcow2 file does not need to be continuous, so you could in theory indeed store the qcow2 file and its data in completely separate places in a tar file.)

What I'm trying to get at is that qcow2 was not designed to be a container format for arbitrary files. If you want to make it such, I'm sure there are existing formats that work better.

Quoted 10 lines
Quoted 4 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into
(1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Max

#63 lore raw
In reply to Dr. David Alan Gilbert
Quoted 44 lines · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

This seems to have fizzled out because of a lack of a concrete proposal; so here is one based on a reply to Max's post:

* Max Reitz ([email protected]) wrote:

<snip>

Quoted 8 lines

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture.

<snip>

Quoted 5 lines

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them?

<snip>

Quoted 4 lines

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

<snip>

Quoted 8 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would think (which may
support JSON at some point?). So basically we would store the data as
a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files. I hate the idea of making qcow2 a random archive format. We have tar for that.

Quoted 8 lines

<snip>

Quoted 3 lines

tl;dr: I really don't get why it's so hard to supply a config file along with a qcow2 image. Is it so hard for people to realize that a VM does not only consist of a disk?

Yes! Because in many cases that's all it needs, and it's ready to run with no unpacking.

It clearly is not, or we would not have this discussion.

The disk image is only enough if you want the default values for all of qemu's configuration options, because today (and if I were to decide, in the future, too) disk images do not configure the VM (well, they configure the guest, but not the VM itself).

Quoted 16 lines

I think we should have:

--------------------------------------------------------------
Layer 0:
QCOW provides a way to store a single string of arbitrary (but
limited?) length.
QCOW provides a way to replace the string by a new string. The original or the new string will be stored after that; never some mix.
Where a file 'b' has a backing file 'a', 'b' inherits the string from 'a' unless 'b' has it's own string. Snapshots inherit their string from the main unless they have their own string.

Layer 1:
The string shall always be a JSON 'object'; i.e. of the form

Quoted 7 lines
    { "something": ... , "more": ... }

The key strings shall be non-null and non-empty and shall be unique.

Layer 2:
'.'s in the key string shall indicate hierarchy

I don't understand why we we'd need dotted syntax when we already have JSON, but that's not my issue.

Quoted 6 lines

Key strings shall be listed in qemu's
docs/specs/qcow-keys.rst

that shall indicate their meaning and the meaning and valid formatting of the value associated with the,

Quoted 7 lines

Key strings shall start with either:
qemu. in which case they must be listed in a file in
the qemu source tree

a reverse dotted name unique to the submitter, they may
be listed in the same file in the source tree, e.g.
com.redhat.

So this is just another configuration file format.

Quoted 10 lines

Layer 3:
QEMU shall, for a given qcow2 file be able to dump the key values.

Layer 4:
On creating a VM by importing a qcow2, a management layer shall inspect the key/values to influence the configuration
of the VM created. Where it imports multiple qcow2's it
shall inspect all the files and flag disagreements.

Quoted 4 lines

Management layers shall, on creating a qcow2 shall set the keys based on the VM the qcow2 is created for. If the qcow2 is created as an additional disk for an exisitng VM it's fine to leave the string empty (e.g. for a data disk).

This at least solves the issue of where qemu should store the data (qemu doesn't care), and how qemu should interpret it (not at all).

But I really, really, really do not like storing arbitrary data in qcow2 files. I hated it badly enough when qemu knew what to do with it, but I hate it even more when even qemu has no idea what to do with it.

Having a specification of what everything means in the qemu tree makes things less unbearable, but not to my liking still.

Quoted 7 lines

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.

Yes, but in the process you've made it completely opaque to qemu, basically, which doesn't really make it better for me. Not that qemu-specific information in qcow2 files would be what I want, but, well.

But it does solve technical issues, I concede that.

Quoted 3 lines

b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.

Not really. The string can be rather long, so you probably don't want to store it in the image header, and thus it's just a binary blob from qcow2's perspective, essentially.

Quoted 11 lines

(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024

I still don't understand why you'd want to put the configuration into qcow2 instead of the other way around.

Or why you'd want to use a single file at all, because as this whole thread shows, a disk image alone is clearly not sufficient to describe a VM.

(Or it may be in simple cases, but then that's because you don't need any configuration.)

Max

#64 lore raw
Quoted 54 lines · * Max Reitz ([email protected]) wrote:
Quoted 44 lines · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

This seems to have fizzled out because of a lack of a concrete proposal; so here is one based on a reply to Max's post:

* Max Reitz ([email protected]) wrote:

<snip>

Quoted 8 lines

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture.

<snip>

Quoted 5 lines

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them?

<snip>

Quoted 4 lines

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

<snip>

Quoted 8 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would think (which may
support JSON at some point?). So basically we would store the data as
a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files. I hate the idea of making qcow2 a random archive format. We have tar for that.

Quoted 8 lines

<snip>

Quoted 3 lines

tl;dr: I really don't get why it's so hard to supply a config file along with a qcow2 image. Is it so hard for people to realize that a VM does not only consist of a disk?

Yes! Because in many cases that's all it needs, and it's ready to run with no unpacking.

Quoted 6 lines

It clearly is not, or we would not have this discussion.

The disk image is only enough if you want the default values for all of qemu's configuration options, because today (and if I were to decide, in the future, too) disk images do not configure the VM (well, they configure the guest, but not the VM itself).

The problem with having a separate file is that you either have to copy it around with the image or have an archive. If you have an archive you have to have an unpacking step which then copies, potentially a lot of data taking some reasonable amount of time. Storing a simple bit of data with the image avoids that.

Quoted 18 lines
Quoted 18 lines

I think we should have:

--------------------------------------------------------------
Layer 0:
QCOW provides a way to store a single string of arbitrary (but
limited?) length.
QCOW provides a way to replace the string by a new string. The original or the new string will be stored after that; never some mix.
Where a file 'b' has a backing file 'a', 'b' inherits the string from 'a' unless 'b' has it's own string. Snapshots inherit their string from the main unless they have their own string.

Layer 1:
The string shall always be a JSON 'object'; i.e. of the form

    { "something": ... , "more": ... }
Quoted 8 lines
Quoted 5 lines

The key strings shall be non-null and non-empty and shall be unique.

Layer 2:
'.'s in the key string shall indicate hierarchy

I don't understand why we we'd need dotted syntax when we already have JSON, but that's not my issue.

I think someone earlier in the thread had asked about how we handled hierarchy so I added it.

Quoted 34 lines
Quoted 6 lines

Key strings shall be listed in qemu's
docs/specs/qcow-keys.rst

that shall indicate their meaning and the meaning and valid formatting of the value associated with the,

Quoted 7 lines

Key strings shall start with either:
qemu. in which case they must be listed in a file in
the qemu source tree

a reverse dotted name unique to the submitter, they may
be listed in the same file in the source tree, e.g.
com.redhat.

So this is just another configuration file format.

Quoted 10 lines

Layer 3:
QEMU shall, for a given qcow2 file be able to dump the key values.

Layer 4:
On creating a VM by importing a qcow2, a management layer shall inspect the key/values to influence the configuration
of the VM created. Where it imports multiple qcow2's it
shall inspect all the files and flag disagreements.

Quoted 4 lines

Management layers shall, on creating a qcow2 shall set the keys based on the VM the qcow2 is created for. If the qcow2 is created as an additional disk for an exisitng VM it's fine to leave the string empty (e.g. for a data disk).

This at least solves the issue of where qemu should store the data (qemu doesn't care), and how qemu should interpret it (not at all).

Quoted 6 lines

But I really, really, really do not like storing arbitrary data in qcow2 files. I hated it badly enough when qemu knew what to do with it, but I hate it even more when even qemu has no idea what to do with it.

Having a specification of what everything means in the qemu tree makes things less unbearable, but not to my liking still.

Have you said why you hate it so much?
Your hate for it seems to be making a simple solution hard.

Quoted 14 lines
Quoted 7 lines

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.

Yes, but in the process you've made it completely opaque to qemu, basically, which doesn't really make it better for me. Not that qemu-specific information in qcow2 files would be what I want, but, well.

But it does solve technical issues, I concede that.

Quoted 7 lines
Quoted 3 lines

b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.

Not really. The string can be rather long, so you probably don't want to store it in the image header, and thus it's just a binary blob from qcow2's perspective, essentially.

Yes, but it's a single blob - I'm not asking for multiple keyed blobs or the ability to update individual blobs; just one blob that I can replace.

Quoted 12 lines
Quoted 11 lines

(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024
Quoted 8 lines

I still don't understand why you'd want to put the configuration into qcow2 instead of the other way around.

Or why you'd want to use a single file at all, because as this whole thread shows, a disk image alone is clearly not sufficient to describe a VM.

(Or it may be in simple cases, but then that's because you don't need any configuration.)

Because it avoids the unpacking associated with archives.

Dave

Quoted 2 lines

Max

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#116 lore raw
In reply to Max Reitz
Quoted 148 lines · On Wed, 6 Jun 2018 13:02:53 +0200 Max Reitz <[email protected]> wrote:
Quoted 123 lines · Michal Suchánek
Quoted 112 lines · On Tue, 29 May 2018 12:14:15 +0200 Max Reitz <[email protected]> wrote:
Quoted 28 lines · Kevin Wolf

Am 28.05.2018 um 23:25 hat Richard W.M. Jones geschrieben:

Quoted 18 lines
Quoted 16 lines · Richard W.M. Jones
Quoted 6 lines · Kevin Wolf

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

We do this already in virt-v2v (using file.offset and file.size parameters in the raw driver).

For virt-v2v we only need to read the source so resizing isn't an issue. For most of the cases we're talking about the downloaded image would also be a template / base image, so I suppose only reading would be required too.

Quoted 8 lines
Quoted 3 lines

I also wrote an nbdkit tar file driver (supports writes, but not resizing).
https://manpages.debian.org/testing/nbdkit-plugin-perl/nbdkit-tar-plugin.1.en.html

I should add the other thorny issue with OVA files is that the metadata contains a checksum (SHA1 or SHA256) of the disk images. If you modify the disk images in-place in the tar file then you need to recalculate those.

Quoted 7 lines

All of this means that OVA isn't really well suited to be used as a native format for VM configuration + images. It's just for sharing read-only images that are converted into another native format before they are used.

Which is probably fair for the use case it was made for, but means that we need something else to solve our problem.

Maybe we should first narrow down our problem. Maybe you have done that already, but I'm quite in the dark still.

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture. Once we support configuring qemu solely through QMP, sure, you can do a blockdev-add and then build the machine accordingly. But that is not here today, and I'm not sure this is a good idea either, because that would mean automagic defaults for the machine-building QMP commands derived from the blockdev-add earlier, which should get a plain "No". Also, having to use QMP to build your machine wouldn't make anything easier; at least not easier than just supplying a configuration file along with the image.

(Building the magic into -blockdev might be less horrible, but such magic (adding block devices influences machine defaults) to me still doesn't seem worth not having to supply a config file along with the disk image.)

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them? But some of those images may only contain data and might be intended to be shared between multiple VMs. So those shouldn't receive the mark. Only disks with binaries should receive them. But what if those binaries are just cross-compiled binaries for some other VM? Oh no, so not even binaries are a sure indicator... So I have no idea where the information is supposed to be stored. In any case, "the first image" just gets an outright "no" from me, and "all images" gets an "I don't think this is a good idea".

Loading is fun, too. OK, so you attach multiple disk images to a VM. Oops, they have varying machine type information... Now what? Use the information from the first one? Definitely no. Just ignore all of the information in such a case and have the user supply the machine type again? Possible, but it seems weird to me that qemu would usually guess the machine type, but once you attach some random other image to it, it suddenly fails to do that. But maybe it's just me who thinks this is weird.

OK, so let's go a step further. We have stored the machine type information in order to not have to supply a config file with the qcow2 image -- because if we did, it could just contain the machine type and that would be it.

So to me it follows naturally that just storing the machine type doesn't make much sense if we cannot also store more VM configuration in a qcow2 file, because I don't see why you should be able to ship an image without a config file only if all you need to supply is a machine type. Often, you also need to supply how much memory the VM needs (which depends on the OS on the image) or what storage controller to use (does the OS have virtio drivers? (to be fair, it usually does, because you're supplying a VM image in the first place)).

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

For one thing, I suspect it to get really ugly implementation-wise. Getting the machine type out of a disk image and actually interpreting it automatically is bad enough, but getting possibly everything out of it? It's not going to be any better.

Quoted 7 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would
think (which may support JSON at some point?). So basically we
would store the data as a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files.

Quoted 1 line

Yes, I wonder. Why did you?

That was mostly directed at Kevin.

My reasoning was that a qcow2 file is a disk image. All data stored therein should be immediately associated with the stored data. Another reason was that from the perspective of qcow2 you don't lose anything by tying the bitmaps directly to that data; all we lost was the capability of storing bitmaps for unrelated raw files.

(And the reasoning for that is "if you want features, use qcow2" -- although R/W backing files may loosen that phrase.)

Quoted 3 lines
Quoted 1 line

I hate the idea of making qcow2 a random archive format.

What's wrong with that?

The fact that qcow2 isn't.

From my perspective it would increase the format's complexity to a point where you could just create a new format altogether. Well, actually, all you do is design a filesystem (or reuse an existing one).

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

We have tar for that.

It does not support expanding the stored files.

Nor does qcow2, because it does not support storing files at all.

AFAICT from the previous discussion it already does allow storing multiple data streams that can be changed independently so it basically is an archive format or filesystem except the streams are not named nor easily accessible separately outside of qemu.

Quoted 10 lines

Secondly, that completely depends on how you use it. You can freely expand the last file in the archive, for instance. Also I've seen people store files in chunks so they can indeed resize it.

(I'm wondering if we could write a block driver that could provide such a chunk allocation transparently to qcow2... Note that a qcow2 file does not need to be continuous, so you could in theory indeed store the qcow2 file and its data in completely separate places in a tar file.)

Which basically invents another new filesystem on top of tar for no good reason. Especially when we have already support for storage format that is capable enough.

Quoted 4 lines

What I'm trying to get at is that qcow2 was not designed to be a container format for arbitrary files. If you want to make it such, I'm sure there are existing formats that work better.

Such as?

Quoted 12 lines
Quoted 11 lines
Quoted 5 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Quoted 7 lines

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

Thanks

Michal

#113 lore raw
In reply to Max Reitz
Quoted 1 line · Max Reitz

On 2018-06-05 11:21, Dr. David Alan Gilbert wrote:

[...]

Quoted 9 lines
Quoted 9 lines

(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

Quoted 8 lines
Quoted 2 lines
   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024

I still don't understand why you'd want to put the configuration into qcow2 instead of the other way around.

Or why you'd want to use a single file at all, because as this whole thread shows, a disk image alone is clearly not sufficient to describe a VM.

I concur to many points made here. I think it would be wrong to put anything besides disk-related data in a disk image.

If we want to have a all-in-one VM image, then it should be something separate from this.

Some more points against squashing all this irrelevant stuff into qcow2 is that if you use it as a disk image only with any higher level management you don't care about any stored configuration.

In fact in libvirt we'd need a way to prevent any of the data from the disk image from being applied to the configuration as it would create problems.

Also there is a big difference between storing "suggestions" of configuration and the actual full configuration itself. The "suggestions" which storage controller or machine type to use are sometimes helpful and sometimes not. Users may have their own preference. And besides this we have the libosinfo project which can provide suggestions.

I think that if the clear separation between a disk image format and an all-in-one VM file is not kept it will end up in a big mess.

#65 lore raw
In reply to Dr. David Alan Gilbert
Quoted 57 lines · Dr. David Alan Gilbert
Quoted 56 lines · * Max Reitz ([email protected]) wrote:
Quoted 44 lines · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

This seems to have fizzled out because of a lack of a concrete proposal; so here is one based on a reply to Max's post:

* Max Reitz ([email protected]) wrote:

<snip>

Quoted 8 lines

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture.

<snip>

Quoted 5 lines

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them?

<snip>

Quoted 4 lines

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

<snip>

Quoted 8 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would think (which may
support JSON at some point?). So basically we would store the data as
a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files. I hate the idea of making qcow2 a random archive format. We have tar for that.

Quoted 8 lines

<snip>

Quoted 3 lines

tl;dr: I really don't get why it's so hard to supply a config file along with a qcow2 image. Is it so hard for people to realize that a VM does not only consist of a disk?

Yes! Because in many cases that's all it needs, and it's ready to run with no unpacking.

It clearly is not, or we would not have this discussion.

Quoted 7 lines
Quoted 4 lines

The disk image is only enough if you want the default values for all of qemu's configuration options, because today (and if I were to decide, in the future, too) disk images do not configure the VM (well, they configure the guest, but not the VM itself).

The problem with having a separate file is that you either have to copy it around with the image

Which is just an inconvenience.

I understand it is an inconvenience and it would be nice to change it, but please understand that I do not want qcow2 to become a filesystem just to relieve an inconvenience.

(Note: I understand that you may not want qcow2 to become a filesystem, but I do get the impression from others.)

Quoted 3 lines

or have an archive. If you have an archive
you have to have an unpacking step which then copies, potentially a lot of data taking some reasonable amount of time.

I'm sure this can be optimized, but yes, I get that.

(If you use e.g. tar and store the image data starting on an FS cluster boundary (64 kB should be more than sufficient), I assume there is a way to extract that data into a new file without copying anything.)

Quoted 2 lines

Storing a simple bit
of data with the image avoids that.

It is not a simple bit of data, as evidenced by the discussion about storing binary blobs and MIME types going on.

Quoted 68 lines
Quoted 18 lines
Quoted 18 lines

I think we should have:

--------------------------------------------------------------
Layer 0:
QCOW provides a way to store a single string of arbitrary (but
limited?) length.
QCOW provides a way to replace the string by a new string. The original or the new string will be stored after that; never some mix.
Where a file 'b' has a backing file 'a', 'b' inherits the string from 'a' unless 'b' has it's own string. Snapshots inherit their string from the main unless they have their own string.

Layer 1:
The string shall always be a JSON 'object'; i.e. of the form

    { "something": ... , "more": ... }
Quoted 8 lines
Quoted 5 lines

The key strings shall be non-null and non-empty and shall be unique.

Layer 2:
'.'s in the key string shall indicate hierarchy

I don't understand why we we'd need dotted syntax when we already have JSON, but that's not my issue.

I think someone earlier in the thread had asked about how we handled hierarchy so I added it.

Quoted 38 lines
Quoted 6 lines

Key strings shall be listed in qemu's
docs/specs/qcow-keys.rst

that shall indicate their meaning and the meaning and valid formatting of the value associated with the,

Quoted 7 lines

Key strings shall start with either:
qemu. in which case they must be listed in a file in
the qemu source tree

a reverse dotted name unique to the submitter, they may
be listed in the same file in the source tree, e.g.
com.redhat.

So this is just another configuration file format.

Quoted 10 lines

Layer 3:
QEMU shall, for a given qcow2 file be able to dump the key values.

Layer 4:
On creating a VM by importing a qcow2, a management layer shall inspect the key/values to influence the configuration
of the VM created. Where it imports multiple qcow2's it
shall inspect all the files and flag disagreements.

Quoted 4 lines

Management layers shall, on creating a qcow2 shall set the keys based on the VM the qcow2 is created for. If the qcow2 is created as an additional disk for an exisitng VM it's fine to leave the string empty (e.g. for a data disk).

This at least solves the issue of where qemu should store the data (qemu doesn't care), and how qemu should interpret it (not at all).

But I really, really, really do not like storing arbitrary data in qcow2 files. I hated it badly enough when qemu knew what to do with it, but I hate it even more when even qemu has no idea what to do with it.

Quoted 5 lines
Quoted 2 lines

Having a specification of what everything means in the qemu tree makes things less unbearable, but not to my liking still.

Have you said why you hate it so much?
Your hate for it seems to be making a simple solution hard.

Because it's a disk image format. Data therein should be relevant to the disk image. I see qcow2 as a representation of data stored on a physical storage medium.

Some metadata associated directly with that is fine (such as dirty bitmaps, backing chains, things like that). But configuring the whole VM seems out of scope to me.

Also, making qcow2 a filesystem is not a simple solution.

...OK, let me back off here, I may be over-interpreting things and throwing opinions of different people into one pot.

Maybe you don't want qcow2 to be a filesystem, and you just want to store a single binary blob. Well, OK, that's not that bad. But in any case, I wouldn't call it a simple solution anymore.

Yes, storing just the machine type somewhere would be possible with a simple solution; but as I said (and the whole thread shows since then), this is a slippery slope, and suddenly we arrive at storing arbitrary binary data (like images?!) along with MIME types. That will not be possible with a simple solution anymore, I don't think.

Quoted 18 lines
Quoted 18 lines
Quoted 7 lines

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.

Yes, but in the process you've made it completely opaque to qemu, basically, which doesn't really make it better for me. Not that qemu-specific information in qcow2 files would be what I want, but, well.

But it does solve technical issues, I concede that.

Quoted 3 lines

b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.

Quoted 7 lines
Quoted 3 lines

Not really. The string can be rather long, so you probably don't want to store it in the image header, and thus it's just a binary blob from qcow2's perspective, essentially.

Yes, but it's a single blob - I'm not asking for multiple keyed blobs or the ability to update individual blobs; just one blob that I can replace.

OK, you aren't, but others seem to be.

Or, well, you call it a single blob. But actually the current ideas seem to be to store a rather large configuration tree with binary data in that blob, so to me personally there is absolutely no functional difference to just storing a tar file in that blob.

So correct me if I'm wrong, but to me it appears that you effectively want to store a filesystem in qcow2.[1] Well, that's better than making qcow2 the filesystem, but it still appears just the wrong way around to me.

[1] Yes, I know that the guest disk already contains an FS. :-P

Quoted 15 lines
Quoted 15 lines
Quoted 11 lines

(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024

I still don't understand why you'd want to put the configuration into qcow2 instead of the other way around.

Quoted 7 lines
Quoted 5 lines

Or why you'd want to use a single file at all, because as this whole thread shows, a disk image alone is clearly not sufficient to describe a VM.

(Or it may be in simple cases, but then that's because you don't need any configuration.)

Because it avoids the unpacking associated with archives.

I'm not talking about unpacking. I'm talking about a potentially new format which allows accessing the qcow2 file in-place. It would probably be trivial to write a block driver to allow this.

(And as I wrote in my response to Michal, I suspect that tar could actually allow this, even though it would probably not be the ideal format.)

Max

#117 lore raw
In reply to Michal Suchánek
Quoted 153 lines · Michal Suchánek
Quoted 150 lines · On Wed, 6 Jun 2018 13:02:53 +0200 Max Reitz <[email protected]> wrote:
Quoted 123 lines · Michal Suchánek
Quoted 112 lines · On Tue, 29 May 2018 12:14:15 +0200 Max Reitz <[email protected]> wrote:
Quoted 28 lines · Kevin Wolf

Am 28.05.2018 um 23:25 hat Richard W.M. Jones geschrieben:

Quoted 18 lines
Quoted 16 lines · Richard W.M. Jones
Quoted 6 lines · Kevin Wolf

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

We do this already in virt-v2v (using file.offset and file.size parameters in the raw driver).

For virt-v2v we only need to read the source so resizing isn't an issue. For most of the cases we're talking about the downloaded image would also be a template / base image, so I suppose only reading would be required too.

Quoted 8 lines
Quoted 3 lines

I also wrote an nbdkit tar file driver (supports writes, but not resizing).
https://manpages.debian.org/testing/nbdkit-plugin-perl/nbdkit-tar-plugin.1.en.html

I should add the other thorny issue with OVA files is that the metadata contains a checksum (SHA1 or SHA256) of the disk images. If you modify the disk images in-place in the tar file then you need to recalculate those.

Quoted 7 lines

All of this means that OVA isn't really well suited to be used as a native format for VM configuration + images. It's just for sharing read-only images that are converted into another native format before they are used.

Which is probably fair for the use case it was made for, but means that we need something else to solve our problem.

Maybe we should first narrow down our problem. Maybe you have done that already, but I'm quite in the dark still.

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture. Once we support configuring qemu solely through QMP, sure, you can do a blockdev-add and then build the machine accordingly. But that is not here today, and I'm not sure this is a good idea either, because that would mean automagic defaults for the machine-building QMP commands derived from the blockdev-add earlier, which should get a plain "No". Also, having to use QMP to build your machine wouldn't make anything easier; at least not easier than just supplying a configuration file along with the image.

(Building the magic into -blockdev might be less horrible, but such magic (adding block devices influences machine defaults) to me still doesn't seem worth not having to supply a config file along with the disk image.)

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them? But some of those images may only contain data and might be intended to be shared between multiple VMs. So those shouldn't receive the mark. Only disks with binaries should receive them. But what if those binaries are just cross-compiled binaries for some other VM? Oh no, so not even binaries are a sure indicator... So I have no idea where the information is supposed to be stored. In any case, "the first image" just gets an outright "no" from me, and "all images" gets an "I don't think this is a good idea".

Loading is fun, too. OK, so you attach multiple disk images to a VM. Oops, they have varying machine type information... Now what? Use the information from the first one? Definitely no. Just ignore all of the information in such a case and have the user supply the machine type again? Possible, but it seems weird to me that qemu would usually guess the machine type, but once you attach some random other image to it, it suddenly fails to do that. But maybe it's just me who thinks this is weird.

OK, so let's go a step further. We have stored the machine type information in order to not have to supply a config file with the qcow2 image -- because if we did, it could just contain the machine type and that would be it.

So to me it follows naturally that just storing the machine type doesn't make much sense if we cannot also store more VM configuration in a qcow2 file, because I don't see why you should be able to ship an image without a config file only if all you need to supply is a machine type. Often, you also need to supply how much memory the VM needs (which depends on the OS on the image) or what storage controller to use (does the OS have virtio drivers? (to be fair, it usually does, because you're supplying a VM image in the first place)).

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

For one thing, I suspect it to get really ugly implementation-wise. Getting the machine type out of a disk image and actually interpreting it automatically is bad enough, but getting possibly everything out of it? It's not going to be any better.

Quoted 7 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would
think (which may support JSON at some point?). So basically we
would store the data as a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files.

Quoted 1 line

Yes, I wonder. Why did you?

That was mostly directed at Kevin.

My reasoning was that a qcow2 file is a disk image. All data stored therein should be immediately associated with the stored data. Another reason was that from the perspective of qcow2 you don't lose anything by tying the bitmaps directly to that data; all we lost was the capability of storing bitmaps for unrelated raw files.

(And the reasoning for that is "if you want features, use qcow2" -- although R/W backing files may loosen that phrase.)

Quoted 3 lines
Quoted 1 line

I hate the idea of making qcow2 a random archive format.

What's wrong with that?

The fact that qcow2 isn't.

From my perspective it would increase the format's complexity to a point where you could just create a new format altogether. Well, actually, all you do is design a filesystem (or reuse an existing one).

Quoted 2 lines
Quoted 1 line

We have tar for that.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

It does not support expanding the stored files.

Nor does qcow2, because it does not support storing files at all.

AFAICT from the previous discussion it already does allow storing multiple data streams that can be changed independently so it basically is an archive format or filesystem except the streams are not named nor easily accessible separately outside of qemu.

I don't quite understand what you are referring to. We have snapshots, we have bitmaps, yes, but all of that are related directly to the stored guest disk data.

The only thing we currently have in qcow2 that is opaque is the VM state that can be stored in snapshots (and don't hold me responsible for that).

Quoted 10 lines
Quoted 9 lines

Secondly, that completely depends on how you use it. You can freely expand the last file in the archive, for instance. Also I've seen people store files in chunks so they can indeed resize it.

(I'm wondering if we could write a block driver that could provide such a chunk allocation transparently to qcow2... Note that a qcow2 file does not need to be continuous, so you could in theory indeed store the qcow2 file and its data in completely separate places in a tar file.)

Quoted 3 lines

Which basically invents another new filesystem on top of tar for no good reason. Especially when we have already support for storage format that is capable enough.

No different from inventing a filesystem on top of qcow2.

I don't think qcow2 is any more capable than tar.

Quoted 5 lines
Quoted 3 lines

What I'm trying to get at is that qcow2 was not designed to be a container format for arbitrary files. If you want to make it such, I'm sure there are existing formats that work better.

Such as?

ext2?

It seems to me that you want to make qcow2 a filesystem. Sure, the FS we'd end up with would probably be simpler than ext2, but I assume thanks to feature creep we'd eventually end up with a qcow2 format that is a worse FS than real FS (especially performance-wise), but that is similarly complex.

Quoted 14 lines
Quoted 14 lines
Quoted 10 lines
Quoted 4 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

Quoted 7 lines
Quoted 4 lines

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

Max

#118 lore raw
Quoted 221 lines · * Max Reitz ([email protected]) wrote:
Quoted 153 lines · Michal Suchánek
Quoted 150 lines · On Wed, 6 Jun 2018 13:02:53 +0200 Max Reitz <[email protected]> wrote:
Quoted 123 lines · Michal Suchánek
Quoted 112 lines · On Tue, 29 May 2018 12:14:15 +0200 Max Reitz <[email protected]> wrote:
Quoted 28 lines · Kevin Wolf

Am 28.05.2018 um 23:25 hat Richard W.M. Jones geschrieben:

Quoted 18 lines
Quoted 16 lines · Richard W.M. Jones
Quoted 6 lines · Kevin Wolf

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

We do this already in virt-v2v (using file.offset and file.size parameters in the raw driver).

For virt-v2v we only need to read the source so resizing isn't an issue. For most of the cases we're talking about the downloaded image would also be a template / base image, so I suppose only reading would be required too.

Quoted 8 lines
Quoted 3 lines

I also wrote an nbdkit tar file driver (supports writes, but not resizing).
https://manpages.debian.org/testing/nbdkit-plugin-perl/nbdkit-tar-plugin.1.en.html

I should add the other thorny issue with OVA files is that the metadata contains a checksum (SHA1 or SHA256) of the disk images. If you modify the disk images in-place in the tar file then you need to recalculate those.

Quoted 7 lines

All of this means that OVA isn't really well suited to be used as a native format for VM configuration + images. It's just for sharing read-only images that are converted into another native format before they are used.

Which is probably fair for the use case it was made for, but means that we need something else to solve our problem.

Maybe we should first narrow down our problem. Maybe you have done that already, but I'm quite in the dark still.

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture. Once we support configuring qemu solely through QMP, sure, you can do a blockdev-add and then build the machine accordingly. But that is not here today, and I'm not sure this is a good idea either, because that would mean automagic defaults for the machine-building QMP commands derived from the blockdev-add earlier, which should get a plain "No". Also, having to use QMP to build your machine wouldn't make anything easier; at least not easier than just supplying a configuration file along with the image.

(Building the magic into -blockdev might be less horrible, but such magic (adding block devices influences machine defaults) to me still doesn't seem worth not having to supply a config file along with the disk image.)

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them? But some of those images may only contain data and might be intended to be shared between multiple VMs. So those shouldn't receive the mark. Only disks with binaries should receive them. But what if those binaries are just cross-compiled binaries for some other VM? Oh no, so not even binaries are a sure indicator... So I have no idea where the information is supposed to be stored. In any case, "the first image" just gets an outright "no" from me, and "all images" gets an "I don't think this is a good idea".

Loading is fun, too. OK, so you attach multiple disk images to a VM. Oops, they have varying machine type information... Now what? Use the information from the first one? Definitely no. Just ignore all of the information in such a case and have the user supply the machine type again? Possible, but it seems weird to me that qemu would usually guess the machine type, but once you attach some random other image to it, it suddenly fails to do that. But maybe it's just me who thinks this is weird.

OK, so let's go a step further. We have stored the machine type information in order to not have to supply a config file with the qcow2 image -- because if we did, it could just contain the machine type and that would be it.

So to me it follows naturally that just storing the machine type doesn't make much sense if we cannot also store more VM configuration in a qcow2 file, because I don't see why you should be able to ship an image without a config file only if all you need to supply is a machine type. Often, you also need to supply how much memory the VM needs (which depends on the OS on the image) or what storage controller to use (does the OS have virtio drivers? (to be fair, it usually does, because you're supplying a VM image in the first place)).

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

For one thing, I suspect it to get really ugly implementation-wise. Getting the machine type out of a disk image and actually interpreting it automatically is bad enough, but getting possibly everything out of it? It's not going to be any better.

Quoted 7 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would
think (which may support JSON at some point?). So basically we
would store the data as a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files.

Quoted 1 line

Yes, I wonder. Why did you?

That was mostly directed at Kevin.

My reasoning was that a qcow2 file is a disk image. All data stored therein should be immediately associated with the stored data. Another reason was that from the perspective of qcow2 you don't lose anything by tying the bitmaps directly to that data; all we lost was the capability of storing bitmaps for unrelated raw files.

(And the reasoning for that is "if you want features, use qcow2" -- although R/W backing files may loosen that phrase.)

Quoted 3 lines
Quoted 1 line

I hate the idea of making qcow2 a random archive format.

What's wrong with that?

The fact that qcow2 isn't.

From my perspective it would increase the format's complexity to a point where you could just create a new format altogether. Well, actually, all you do is design a filesystem (or reuse an existing one).

Quoted 2 lines
Quoted 1 line

We have tar for that.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

It does not support expanding the stored files.

Nor does qcow2, because it does not support storing files at all.

AFAICT from the previous discussion it already does allow storing multiple data streams that can be changed independently so it basically is an archive format or filesystem except the streams are not named nor easily accessible separately outside of qemu.

I don't quite understand what you are referring to. We have snapshots, we have bitmaps, yes, but all of that are related directly to the stored guest disk data.

The only thing we currently have in qcow2 that is opaque is the VM state that can be stored in snapshots (and don't hold me responsible for that).

Quoted 10 lines
Quoted 9 lines

Secondly, that completely depends on how you use it. You can freely expand the last file in the archive, for instance. Also I've seen people store files in chunks so they can indeed resize it.

(I'm wondering if we could write a block driver that could provide such a chunk allocation transparently to qcow2... Note that a qcow2 file does not need to be continuous, so you could in theory indeed store the qcow2 file and its data in completely separate places in a tar file.)

Quoted 3 lines

Which basically invents another new filesystem on top of tar for no good reason. Especially when we have already support for storage format that is capable enough.

No different from inventing a filesystem on top of qcow2.

I don't think qcow2 is any more capable than tar.

Quoted 5 lines
Quoted 3 lines

What I'm trying to get at is that qcow2 was not designed to be a container format for arbitrary files. If you want to make it such, I'm sure there are existing formats that work better.

Such as?

ext2?

It seems to me that you want to make qcow2 a filesystem. Sure, the FS we'd end up with would probably be simpler than ext2, but I assume thanks to feature creep we'd eventually end up with a qcow2 format that is a worse FS than real FS (especially performance-wise), but that is similarly complex.

Quoted 19 lines
Quoted 18 lines
Quoted 10 lines
Quoted 4 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Quoted 5 lines
Quoted 2 lines

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

Because then we'd have to change the whole stack to take advantage of that. Adding a feature into qcow2 means nothing else changes.

Dave

Quoted 2 lines

Max

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#150 lore raw
In reply to Max Reitz
Quoted 4 lines · Max Reitz

(I'm wondering if we could write a block driver that could provide such a chunk allocation transparently to qcow2... Note that a qcow2 file does not need to be continuous, so you could in theory indeed store the qcow2 file and its data in completely separate places in a tar file.)

nbdkit-split-plugin
(https://github.com/libguestfs/nbdkit/tree/master/plugins/split). It currently doesn't support resizing although it could do fairly easily.

Quoted 2 lines

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

I started off a long reply here, but I think you're right. If we cannot make people decide on and use a proper disk image + metadata container, then it's also unlikely we'll get them to add sensible metadata to their qcow2 images either :-(

Rich.

Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org
#107 lore raw
In reply to Dr. David Alan Gilbert
Quoted 5 lines · Dr. David Alan Gilbert

The problem with having a separate file is that you either have to copy it around with the image or have an archive. If you have an archive you have to have an unpacking step which then copies, potentially a lot of data taking some reasonable amount of time. Storing a simple bit of data with the image avoids that.

This isn't really true. For OVA (ie. tar) we don't unpack them. Adding file.offset and file.size in qemu's raw driver was crucial to that optimization.

Rich.

Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org
#137 lore raw
In reply to Max Reitz
Quoted 167 lines · On Wed, 6 Jun 2018 13:32:47 +0200 Max Reitz <[email protected]> wrote:
Quoted 157 lines · Michal Suchánek
Quoted 154 lines · On Wed, 6 Jun 2018 13:02:53 +0200 Max Reitz <[email protected]> wrote:
Quoted 126 lines · Michal Suchánek
Quoted 114 lines · On Tue, 29 May 2018 12:14:15 +0200 Max Reitz <[email protected]> wrote:
Quoted 29 lines · Kevin Wolf

Am 28.05.2018 um 23:25 hat Richard W.M. Jones geschrieben:

Quoted 19 lines
Quoted 17 lines · Richard W.M. Jones
Quoted 6 lines · Kevin Wolf

Just accessing the image file within a tar archive is possible and we could write a block driver for that (I actually think we should do this), but it restricts you because certain operations like resizing aren't really possible in tar. Unfortunately, resizing is a really common operation for non-raw image formats.

We do this already in virt-v2v (using file.offset and file.size parameters in the raw driver).

For virt-v2v we only need to read the source so resizing isn't an issue. For most of the cases we're talking about the downloaded image would also be a template / base image, so I suppose only reading would be required too.

Quoted 8 lines
Quoted 3 lines

I also wrote an nbdkit tar file driver (supports writes, but not resizing).
https://manpages.debian.org/testing/nbdkit-plugin-perl/nbdkit-tar-plugin.1.en.html

I should add the other thorny issue with OVA files is that the metadata contains a checksum (SHA1 or SHA256) of the disk images. If you modify the disk images in-place in the tar file then you need to recalculate those.

Quoted 7 lines

All of this means that OVA isn't really well suited to be used as a native format for VM configuration + images. It's just for sharing read-only images that are converted into another native format before they are used.

Which is probably fair for the use case it was made for, but means that we need something else to solve our problem.

Maybe we should first narrow down our problem. Maybe you have done that already, but I'm quite in the dark still.

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture. Once we support configuring qemu solely through QMP, sure, you can do a blockdev-add and then build the machine accordingly. But that is not here today, and I'm not sure this is a good idea either, because that would mean automagic defaults for the machine-building QMP commands derived from the blockdev-add earlier, which should get a plain "No". Also, having to use QMP to build your machine wouldn't make anything easier; at least not easier than just supplying a configuration file along with the image.

(Building the magic into -blockdev might be less horrible, but such magic (adding block devices influences machine defaults) to me still doesn't seem worth not having to supply a config file along with the disk image.)

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them? But some of those images may only contain data and might be intended to be shared between multiple VMs. So those shouldn't receive the mark. Only disks with binaries should receive them. But what if those binaries are just cross-compiled binaries for some other VM? Oh no, so not even binaries are a sure indicator... So I have no idea where the information is supposed to be stored. In any case, "the first image" just gets an outright "no" from me, and "all images" gets an "I don't think this is a good idea".

Loading is fun, too. OK, so you attach multiple disk images to a VM. Oops, they have varying machine type information... Now what? Use the information from the first one? Definitely no. Just ignore all of the information in such a case and have the user supply the machine type again? Possible, but it seems weird to me that qemu would usually guess the machine type, but once you attach some random other image to it, it suddenly fails to do that. But maybe it's just me who thinks this is weird.

OK, so let's go a step further. We have stored the machine type information in order to not have to supply a config file with the qcow2 image -- because if we did, it could just contain the machine type and that would be it.

So to me it follows naturally that just storing the machine type doesn't make much sense if we cannot also store more VM configuration in a qcow2 file, because I don't see why you should be able to ship an image without a config file only if all you need to supply is a machine type. Often, you also need to supply how much memory the VM needs (which depends on the OS on the image) or what storage controller to use (does the OS have virtio drivers? (to be fair, it usually does, because you're supplying a VM image in the first place)).

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

For one thing, I suspect it to get really ugly implementation-wise. Getting the machine type out of a disk image and actually interpreting it automatically is bad enough, but getting possibly everything out of it? It's not going to be any better.

Quoted 8 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would think (which may support JSON at some point?). So basically we would store the data as a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files.

Quoted 1 line

Yes, I wonder. Why did you?

That was mostly directed at Kevin.

My reasoning was that a qcow2 file is a disk image. All data stored therein should be immediately associated with the stored data. Another reason was that from the perspective of qcow2 you don't lose anything by tying the bitmaps directly to that data; all we lost was the capability of storing bitmaps for unrelated raw files.

(And the reasoning for that is "if you want features, use qcow2" -- although R/W backing files may loosen that phrase.)

Quoted 3 lines
Quoted 1 line

I hate the idea of making qcow2 a random archive format.

What's wrong with that?

The fact that qcow2 isn't.

From my perspective it would increase the format's complexity to a point where you could just create a new format altogether. Well, actually, all you do is design a filesystem (or reuse an existing one).

Quoted 2 lines
Quoted 1 line

We have tar for that.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

It does not support expanding the stored files.

Nor does qcow2, because it does not support storing files at all.

AFAICT from the previous discussion it already does allow storing multiple data streams that can be changed independently so it basically is an archive format or filesystem except the streams are not named nor easily accessible separately outside of qemu.

Quoted 7 lines

I don't quite understand what you are referring to. We have snapshots, we have bitmaps, yes, but all of that are related directly to the stored guest disk data.

The only thing we currently have in qcow2 that is opaque is the VM state that can be stored in snapshots (and don't hold me responsible for that).

But it has to be related to the stored disk data only because of your dislike for stuff not related to the disk data. Not for a technical reason. The format can sustain storing unrelated data.

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

Secondly, that completely depends on how you use it. You can freely expand the last file in the archive, for instance. Also I've seen people store files in chunks so they can indeed resize it.

(I'm wondering if we could write a block driver that could provide such a chunk allocation transparently to qcow2... Note that a qcow2 file does not need to be continuous, so you could in theory indeed store the qcow2 file and its data in completely separate places in a tar file.)

Quoted 7 lines
Quoted 3 lines

Which basically invents another new filesystem on top of tar for no good reason. Especially when we have already support for storage format that is capable enough.

No different from inventing a filesystem on top of qcow2.

I don't think qcow2 is any more capable than tar.

It can natively resize the objects it stores. tar cannot do that so you will have to store random nonsense in the tar archive that only makes sense for your fs/tar driver.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

What I'm trying to get at is that qcow2 was not designed to be a container format for arbitrary files. If you want to make it such, I'm sure there are existing formats that work better.

Such as?

ext2?

So you want an ext2 driver in qemu instead of expanding qcow2 to work not only for a single disk but also for an appliance?

Quoted 6 lines

It seems to me that you want to make qcow2 a filesystem. Sure, the FS we'd end up with would probably be simpler than ext2, but I assume thanks to feature creep we'd eventually end up with a qcow2 format that is a worse FS than real FS (especially performance-wise), but that is similarly complex.

I do not see how the complexity increases drastically by assigning user-visible names to some of the data stored in the image. I am not familiar with the internals, though.

Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
Quoted 11 lines
Quoted 5 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Quoted 6 lines
Quoted 2 lines

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

qemu cannot read the disk data from the file in-place.

Thanks

Michal

#119 lore raw
In reply to Dr. David Alan Gilbert
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 7 lines · * Max Reitz ([email protected]) wrote:
Quoted 6 lines · Michal Suchánek
Quoted 3 lines · On Wed, 6 Jun 2018 13:02:53 +0200 Max Reitz <[email protected]> wrote:
Quoted 2 lines · Michal Suchánek

On Tue, 29 May 2018 12:14:15 +0200
Max Reitz <[email protected]> wrote:

[...]

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 10 lines
Quoted 4 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

Because then we'd have to change the whole stack to take advantage of that. Adding a feature into qcow2 means nothing else changes.

Because it's a hack, right. Storing binary data in a qcow2 file, completely ignoring it in qemu (and being completely unusable to any potential other users of the qcow2 format[1]) and only interpreting it somewhere up the stack is a hack.

That is not necessarily a negative point, hacks can work wonderfully well, and they usually are simple, that is correct. But the thing is that I feel like people have grand visions of what to get out of this. Imagine, a single file that can configure all and any VM!

But hacks usually only solve a single issue. Once you try to extend a hack, it breaks down and becomes insufficient.

If we want a grand vision where a single file stores the whole VM, why not invest the work and make it right from the start?

Max

[1] Yes, I concede that there are probably no other users of qcow2. But please forgive me for assuming that qcow2 was in a sense designed to be a rather general image format that not only qemu could use.

#108 lore raw
In reply to Richard W.M. Jones
Quoted 10 lines · Richard W.M. Jones
Quoted 5 lines · Dr. David Alan Gilbert

The problem with having a separate file is that you either have to copy it around with the image or have an archive. If you have an archive you have to have an unpacking step which then copies, potentially a lot of data taking some reasonable amount of time. Storing a simple bit of data with the image avoids that.

This isn't really true. For OVA (ie. tar) we don't unpack them. Adding file.offset and file.size in qemu's raw driver was crucial to that optimization.

Though that assumes you're only using the qcow2 file in read-only mode. As soon as you need write access you need to unpack from the OVA so that the qcow2 file can grow its length when new sectors are allocated.

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 :|
#138 lore raw
In reply to Michal Suchánek
Quoted 10 lines · Michal Suchánek
Quoted 7 lines · On Wed, 6 Jun 2018 13:32:47 +0200 Max Reitz <[email protected]> wrote:
Quoted 6 lines · Michal Suchánek
Quoted 3 lines · On Wed, 6 Jun 2018 13:02:53 +0200 Max Reitz <[email protected]> wrote:
Quoted 2 lines · Michal Suchánek

On Tue, 29 May 2018 12:14:15 +0200
Max Reitz <[email protected]> wrote:

[...]

Quoted 26 lines
Quoted 26 lines
Quoted 13 lines
Quoted 13 lines
Quoted 3 lines
Quoted 1 line

I hate the idea of making qcow2 a random archive format.

What's wrong with that?

The fact that qcow2 isn't.

From my perspective it would increase the format's complexity to a point where you could just create a new format altogether. Well, actually, all you do is design a filesystem (or reuse an existing one).

Quoted 2 lines
Quoted 1 line

We have tar for that.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

It does not support expanding the stored files.

Nor does qcow2, because it does not support storing files at all.

AFAICT from the previous discussion it already does allow storing multiple data streams that can be changed independently so it basically is an archive format or filesystem except the streams are not named nor easily accessible separately outside of qemu.

I don't quite understand what you are referring to. We have snapshots, we have bitmaps, yes, but all of that are related directly to the stored guest disk data.

Quoted 7 lines
Quoted 3 lines

The only thing we currently have in qcow2 that is opaque is the VM state that can be stored in snapshots (and don't hold me responsible for that).

But it has to be related to the stored disk data only because of your dislike for stuff not related to the disk data. Not for a technical reason. The format can sustain storing unrelated data.

Yes. Technically, you can even store data without qcow2 knowing, except that qemu-img check -r leaks will delete it, but yeah.

Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 10 lines

Secondly, that completely depends on how you use it. You can freely expand the last file in the archive, for instance. Also I've seen people store files in chunks so they can indeed resize it.

(I'm wondering if we could write a block driver that could provide such a chunk allocation transparently to qcow2... Note that a qcow2 file does not need to be continuous, so you could in theory indeed store the qcow2 file and its data in completely separate places in a tar file.)

Which basically invents another new filesystem on top of tar for no good reason. Especially when we have already support for storage format that is capable enough.

Quoted 5 lines
Quoted 3 lines

No different from inventing a filesystem on top of qcow2.

I don't think qcow2 is any more capable than tar.

It can natively resize the objects it stores.

It does not store arbitrary objects. It stores a guest disk (and snapshots), and bitmaps. These are stored in directory structures so new chunks can be dynamically added. Note that both use slightly different structures.

Yes, it is technically possible to use a similar structure to store arbitrary objects. But currently it does not have that capability.

Quoted 3 lines

tar cannot do that so you
will have to store random nonsense in the tar archive that only makes sense for your fs/tar driver.

Right. But what's the difference to storing random nonsense in a qcow2 file that not even makes sense to qemu?

Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

What I'm trying to get at is that qcow2 was not designed to be a container format for arbitrary files. If you want to make it such, I'm sure there are existing formats that work better.

Such as?

ext2?

So you want an ext2 driver in qemu instead of expanding qcow2 to work not only for a single disk but also for an appliance?

Yes, because ext2 was designed to be a proper filesystem. I'm not an FS designer. Well, not a good one anyway. So I don't trust myself on extending qcow2 to be a good FS -- and why would I, when there are already numerous FS around.

Quoted 9 lines
Quoted 5 lines

It seems to me that you want to make qcow2 a filesystem. Sure, the FS we'd end up with would probably be simpler than ext2, but I assume thanks to feature creep we'd eventually end up with a qcow2 format that is a worse FS than real FS (especially performance-wise), but that is similarly complex.

I do not see how the complexity increases drastically by assigning user-visible names to some of the data stored in the image. I am not familiar with the internals, though.

As I said, qcow2 does not store objects currently. It stores specific data structures that differ. There is no common "object structure".

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 10 lines
Quoted 4 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

qemu cannot read the disk data from the file in-place.

Hu? Why not?

Max

#109 lore raw
In reply to Daniel P. Berrangé
Quoted 8 lines · Daniel P. Berrangé
Quoted 7 lines · Richard W.M. Jones
Quoted 5 lines · Dr. David Alan Gilbert

The problem with having a separate file is that you either have to copy it around with the image or have an archive. If you have an archive you have to have an unpacking step which then copies, potentially a lot of data taking some reasonable amount of time. Storing a simple bit of data with the image avoids that.

Quoted 7 lines
Quoted 3 lines

This isn't really true. For OVA (ie. tar) we don't unpack them. Adding file.offset and file.size in qemu's raw driver was crucial to that optimization.

Though that assumes you're only using the qcow2 file in read-only mode. As soon as you need write access you need to unpack from the OVA so that the qcow2 file can grow its length when new sectors are allocated.

Except if the qcow2 file is at the end of the archive. Then all you need to do is adjust the length field of the tar file header.

Max

#66 lore raw
In reply to Max Reitz
Quoted 63 lines · * Max Reitz ([email protected]) wrote:
Quoted 62 lines · Dr. David Alan Gilbert
Quoted 60 lines · * Max Reitz ([email protected]) wrote:
Quoted 44 lines · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

This seems to have fizzled out because of a lack of a concrete proposal; so here is one based on a reply to Max's post:

* Max Reitz ([email protected]) wrote:

<snip>

Quoted 8 lines

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture.

<snip>

Quoted 5 lines

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them?

<snip>

Quoted 4 lines

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

<snip>

Quoted 8 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would think (which may
support JSON at some point?). So basically we would store the data as
a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files. I hate the idea of making qcow2 a random archive format. We have tar for that.

Quoted 8 lines

<snip>

Quoted 3 lines

tl;dr: I really don't get why it's so hard to supply a config file along with a qcow2 image. Is it so hard for people to realize that a VM does not only consist of a disk?

Yes! Because in many cases that's all it needs, and it's ready to run with no unpacking.

It clearly is not, or we would not have this discussion.

The disk image is only enough if you want the default values for all of qemu's configuration options, because today (and if I were to decide, in the future, too) disk images do not configure the VM (well, they configure the guest, but not the VM itself).

Quoted 4 lines
Quoted 2 lines

The problem with having a separate file is that you either have to copy it around with the image

Which is just an inconvenience.

It's more than that; if it's a separate file then the tools can't rely on users supplying it, and frankly they won't and they'll still just supply an image.

Quoted 3 lines

I understand it is an inconvenience and it would be nice to change it, but please understand that I do not want qcow2 to become a filesystem just to relieve an inconvenience.

I very much don't want it to be a filesystem; my reason for writing down my spec the way I did was to make it clear that the only thing I want of qcow2 is a single blob, no more; I don't want naming of the blob or anything else.

Quoted 2 lines

(Note: I understand that you may not want qcow2 to become a filesystem, but I do get the impression from others.)

My aim was to specify it to fulfill the requirements that everyone else had asked for, but still only having one unmodifiable blob in qcow.

Quoted 9 lines
Quoted 3 lines

or have an archive. If you have an archive
you have to have an unpacking step which then copies, potentially a lot of data taking some reasonable amount of time.

I'm sure this can be optimized, but yes, I get that.

(If you use e.g. tar and store the image data starting on an FS cluster boundary (64 kB should be more than sufficient), I assume there is a way to extract that data into a new file without copying anything.)

But then we have to modify all the current things that know how to handle a qcow2.

Quoted 5 lines
Quoted 2 lines

Storing a simple bit
of data with the image avoids that.

It is not a simple bit of data, as evidenced by the discussion about storing binary blobs and MIME types going on.

All of the things they've suggested can be done inside that one blob; even inside the json (or any other structure in that blob).

Quoted 71 lines
Quoted 71 lines
Quoted 18 lines
Quoted 18 lines

I think we should have:

--------------------------------------------------------------
Layer 0:
QCOW provides a way to store a single string of arbitrary (but
limited?) length.
QCOW provides a way to replace the string by a new string. The original or the new string will be stored after that; never some mix.
Where a file 'b' has a backing file 'a', 'b' inherits the string from 'a' unless 'b' has it's own string. Snapshots inherit their string from the main unless they have their own string.

Layer 1:
The string shall always be a JSON 'object'; i.e. of the form

    { "something": ... , "more": ... }
Quoted 8 lines
Quoted 5 lines

The key strings shall be non-null and non-empty and shall be unique.

Layer 2:
'.'s in the key string shall indicate hierarchy

I don't understand why we we'd need dotted syntax when we already have JSON, but that's not my issue.

I think someone earlier in the thread had asked about how we handled hierarchy so I added it.

Quoted 40 lines
Quoted 6 lines

Key strings shall be listed in qemu's
docs/specs/qcow-keys.rst

that shall indicate their meaning and the meaning and valid formatting of the value associated with the,

Quoted 7 lines

Key strings shall start with either:
qemu. in which case they must be listed in a file in
the qemu source tree

a reverse dotted name unique to the submitter, they may
be listed in the same file in the source tree, e.g.
com.redhat.

So this is just another configuration file format.

Quoted 10 lines

Layer 3:
QEMU shall, for a given qcow2 file be able to dump the key values.

Layer 4:
On creating a VM by importing a qcow2, a management layer shall inspect the key/values to influence the configuration
of the VM created. Where it imports multiple qcow2's it
shall inspect all the files and flag disagreements.

Quoted 4 lines

Management layers shall, on creating a qcow2 shall set the keys based on the VM the qcow2 is created for. If the qcow2 is created as an additional disk for an exisitng VM it's fine to leave the string empty (e.g. for a data disk).

This at least solves the issue of where qemu should store the data (qemu doesn't care), and how qemu should interpret it (not at all).

But I really, really, really do not like storing arbitrary data in qcow2 files. I hated it badly enough when qemu knew what to do with it, but I hate it even more when even qemu has no idea what to do with it.

Having a specification of what everything means in the qemu tree makes things less unbearable, but not to my liking still.

Quoted 6 lines
Quoted 2 lines

Have you said why you hate it so much?
Your hate for it seems to be making a simple solution hard.

Because it's a disk image format. Data therein should be relevant to the disk image. I see qcow2 as a representation of data stored on a physical storage medium.

What we're missing here is the notes scribbled on the sticky label on the disc; you rarely need them on a physical drive in a computer, LUNs on a SAN don't need them that much because they have a full filesystem and don't move about much. Here we're talking about an image being downloaded or sent between people.

Quoted 13 lines

Some metadata associated directly with that is fine (such as dirty bitmaps, backing chains, things like that). But configuring the whole VM seems out of scope to me.

Also, making qcow2 a filesystem is not a simple solution.

...OK, let me back off here, I may be over-interpreting things and throwing opinions of different people into one pot.

Maybe you don't want qcow2 to be a filesystem, and you just want to store a single binary blob. Well, OK, that's not that bad. But in any case, I wouldn't call it a simple solution anymore.

Quoted 5 lines

Yes, storing just the machine type somewhere would be possible with a simple solution; but as I said (and the whole thread shows since then), this is a slippery slope, and suddenly we arrive at storing arbitrary binary data (like images?!) along with MIME types. That will not be possible with a simple solution anymore, I don't think.

Right; I was thinking we were too far down that slope to get rid of all of those requirements, but I was trying to force it back to being a single blob as far as QCOW2 saw it.

Quoted 28 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.

Yes, but in the process you've made it completely opaque to qemu, basically, which doesn't really make it better for me. Not that qemu-specific information in qcow2 files would be what I want, but, well.

But it does solve technical issues, I concede that.

Quoted 3 lines

b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.

Quoted 7 lines
Quoted 3 lines

Not really. The string can be rather long, so you probably don't want to store it in the image header, and thus it's just a binary blob from qcow2's perspective, essentially.

Yes, but it's a single blob - I'm not asking for multiple keyed blobs or the ability to update individual blobs; just one blob that I can replace.

OK, you aren't, but others seem to be.

Quoted 8 lines

Or, well, you call it a single blob. But actually the current ideas seem to be to store a rather large configuration tree with binary data in that blob, so to me personally there is absolutely no functional difference to just storing a tar file in that blob.

So correct me if I'm wrong, but to me it appears that you effectively want to store a filesystem in qcow2.[1] Well, that's better than making qcow2 the filesystem, but it still appears just the wrong way around to me.

It's different in the sense that what we end up with is still a qcow2; anything that just handles qcow2's and can pass them through doesn't need to do anything different; users don't need to do anything different. No one has to pack/unpack the file.

Quoted 23 lines

[1] Yes, I know that the guest disk already contains an FS. :-P

Quoted 21 lines
Quoted 20 lines
Quoted 11 lines

(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024

I still don't understand why you'd want to put the configuration into qcow2 instead of the other way around.

Or why you'd want to use a single file at all, because as this whole thread shows, a disk image alone is clearly not sufficient to describe a VM.

(Or it may be in simple cases, but then that's because you don't need any configuration.)

Quoted 8 lines
Quoted 1 line

Because it avoids the unpacking associated with archives.

I'm not talking about unpacking. I'm talking about a potentially new format which allows accessing the qcow2 file in-place. It would probably be trivial to write a block driver to allow this.

(And as I wrote in my response to Michal, I suspect that tar could actually allow this, even though it would probably not be the ideal format.)

As above, I don't think this is trivial; you have to change all the layers; lets say it was a tar; you'd have to somehow know that you're importing one of these special tars, you also have to have a tool to create them; and you have to worry about whether that alignment is correct for the storage/memory you're using it with.

Dave

Quoted 2 lines

Max

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#110 lore raw
In reply to Daniel P. Berrangé
Quoted 8 lines · * Daniel P. Berrangé ([email protected]) wrote:
Quoted 7 lines · Richard W.M. Jones
Quoted 5 lines · Dr. David Alan Gilbert

The problem with having a separate file is that you either have to copy it around with the image or have an archive. If you have an archive you have to have an unpacking step which then copies, potentially a lot of data taking some reasonable amount of time. Storing a simple bit of data with the image avoids that.

Quoted 7 lines
Quoted 3 lines

This isn't really true. For OVA (ie. tar) we don't unpack them. Adding file.offset and file.size in qemu's raw driver was crucial to that optimization.

Though that assumes you're only using the qcow2 file in read-only mode. As soon as you need write access you need to unpack from the OVA so that the qcow2 file can grow its length when new sectors are allocated.

And the person creating the OVA has to do that taring rather than just take the qcow2 they've just used in the VM.

Dave

Quoted 7 lines

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 :|

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#139 lore raw
In reply to Max Reitz
Quoted 97 lines · On Wed, 6 Jun 2018 13:52:35 +0200 Max Reitz <[email protected]> wrote:
Quoted 10 lines · Michal Suchánek
Quoted 7 lines · On Wed, 6 Jun 2018 13:32:47 +0200 Max Reitz <[email protected]> wrote:
Quoted 6 lines · Michal Suchánek
Quoted 3 lines · On Wed, 6 Jun 2018 13:02:53 +0200 Max Reitz <[email protected]> wrote:
Quoted 2 lines · Michal Suchánek

On Tue, 29 May 2018 12:14:15 +0200
Max Reitz <[email protected]> wrote:

[...]

Quoted 28 lines
Quoted 28 lines
Quoted 15 lines
Quoted 15 lines
Quoted 3 lines
Quoted 1 line

I hate the idea of making qcow2 a random archive format.

What's wrong with that?

The fact that qcow2 isn't.

From my perspective it would increase the format's complexity to a point where you could just create a new format altogether. Well, actually, all you do is design a filesystem (or reuse an existing one).

Quoted 3 lines
Quoted 1 line

We have tar for that.

It does not support expanding the stored files.

Quoted 8 lines
Quoted 2 lines

Nor does qcow2, because it does not support storing files at all.

AFAICT from the previous discussion it already does allow storing multiple data streams that can be changed independently so it basically is an archive format or filesystem except the streams are not named nor easily accessible separately outside of qemu.

I don't quite understand what you are referring to. We have snapshots, we have bitmaps, yes, but all of that are related directly to the stored guest disk data.

Quoted 7 lines
Quoted 3 lines

The only thing we currently have in qcow2 that is opaque is the VM state that can be stored in snapshots (and don't hold me responsible for that).

But it has to be related to the stored disk data only because of your dislike for stuff not related to the disk data. Not for a technical reason. The format can sustain storing unrelated data.

Yes. Technically, you can even store data without qcow2 knowing, except that qemu-img check -r leaks will delete it, but yeah.

Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 10 lines

Secondly, that completely depends on how you use it. You can freely expand the last file in the archive, for instance. Also I've seen people store files in chunks so they can indeed resize it.

(I'm wondering if we could write a block driver that could provide such a chunk allocation transparently to qcow2... Note that a qcow2 file does not need to be continuous, so you could in theory indeed store the qcow2 file and its data in completely separate places in a tar file.)

Which basically invents another new filesystem on top of tar for no good reason. Especially when we have already support for storage format that is capable enough.

Quoted 5 lines
Quoted 3 lines

No different from inventing a filesystem on top of qcow2.

I don't think qcow2 is any more capable than tar.

It can natively resize the objects it stores.

It does not store arbitrary objects. It stores a guest disk (and snapshots), and bitmaps. These are stored in directory structures so new chunks can be dynamically added. Note that both use slightly different structures.

Yes, it is technically possible to use a similar structure to store arbitrary objects. But currently it does not have that capability.

Quoted 3 lines

tar cannot do that
so you will have to store random nonsense in the tar archive that only makes sense for your fs/tar driver.

Right. But what's the difference to storing random nonsense in a qcow2 file that not even makes sense to qemu?

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

What I'm trying to get at is that qcow2 was not designed to be a container format for arbitrary files. If you want to make it such, I'm sure there are existing formats that work better.

Such as?

ext2?

Quoted 7 lines
Quoted 2 lines

So you want an ext2 driver in qemu instead of expanding qcow2 to work not only for a single disk but also for an appliance?

Yes, because ext2 was designed to be a proper filesystem. I'm not an FS designer. Well, not a good one anyway. So I don't trust myself on extending qcow2 to be a good FS -- and why would I, when there are already numerous FS around.

Do you expect that performance of qemu using qcow2 driver over ext2 driver will be better than using qcow driver directly with some part semi-permanently occupied by a configuration blob? My bet is not.

The ext* drivers are designed to work with kernel VM infrastructure which must be tuned for different usage scenarios and you would have to duplicate that tuning in qemu to get competitive performance. Also you get qcow2 and ext2 metadata which must be allocated, managed, etc. You get more storage and performance overhead for no good reason.

On the other hand, qcow is designed for storing VM disk data and hopefully was tuned to do that decently over the years. The primary use case remains storing VM disk data. Adding a configuration blob does not change that.

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 11 lines
Quoted 10 lines
Quoted 4 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Quoted 7 lines

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

qemu cannot read the disk data from the file in-place.

Hu? Why not?

Well, it can possibly read the image if it happens to be continuous. It will not be able to update it without a fs driver, however.

Thanks

Michal

#120 lore raw
In reply to Max Reitz
Quoted 37 lines · * Max Reitz ([email protected]) wrote:
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 7 lines · * Max Reitz ([email protected]) wrote:
Quoted 6 lines · Michal Suchánek
Quoted 3 lines · On Wed, 6 Jun 2018 13:02:53 +0200 Max Reitz <[email protected]> wrote:
Quoted 2 lines · Michal Suchánek

On Tue, 29 May 2018 12:14:15 +0200
Max Reitz <[email protected]> wrote:

[...]

Quoted 25 lines
Quoted 24 lines
Quoted 14 lines
Quoted 14 lines
Quoted 10 lines
Quoted 4 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

Quoted 7 lines
Quoted 4 lines

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

Quoted 7 lines
Quoted 2 lines

Because then we'd have to change the whole stack to take advantage of that. Adding a feature into qcow2 means nothing else changes.

Because it's a hack, right. Storing binary data in a qcow2 file, completely ignoring it in qemu (and being completely unusable to any potential other users of the qcow2 format[1]) and only interpreting it somewhere up the stack is a hack.

It's not a hack!
Seriously it's not.
There's nothing wrong with it being aimed higher up the stack than qemu, the problem we started off with was what happens when a user downloads a VM image and tries to import it into their VM system; weve already got 2+ layers of management stuff in there - I want the information to guide those layers, not form a complete set of configuration.

Quoted 10 lines

That is not necessarily a negative point, hacks can work wonderfully well, and they usually are simple, that is correct. But the thing is that I feel like people have grand visions of what to get out of this. Imagine, a single file that can configure all and any VM!

But hacks usually only solve a single issue. Once you try to extend a hack, it breaks down and becomes insufficient.

If we want a grand vision where a single file stores the whole VM, why not invest the work and make it right from the start?

Because we won't get it right; however much we bikeshed about it
we'll just end up with a mess. The right thing is to put in something
to hold configuration and then review the items of configuration we add properly as we define them.

Quoted 5 lines

Max

[1] Yes, I concede that there are probably no other users of qcow2. But please forgive me for assuming that qcow2 was in a sense designed to be a rather general image format that not only qemu could use.

What makes it QEMU specific? It's basically just the same key/value setup as OVA, except putting them inside the qcow2.
We could use the same keys/value definitions as OVA in the blob, although their definitions aren't very portable either.

Dave

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#112 lore raw
In reply to Daniel P. Berrangé
Quoted 8 lines · Daniel P. Berrangé
Quoted 7 lines · Richard W.M. Jones
Quoted 5 lines · Dr. David Alan Gilbert

The problem with having a separate file is that you either have to copy it around with the image or have an archive. If you have an archive you have to have an unpacking step which then copies, potentially a lot of data taking some reasonable amount of time. Storing a simple bit of data with the image avoids that.

Quoted 7 lines
Quoted 3 lines

This isn't really true. For OVA (ie. tar) we don't unpack them. Adding file.offset and file.size in qemu's raw driver was crucial to that optimization.

Though that assumes you're only using the qcow2 file in read-only mode. As soon as you need write access you need to unpack from the OVA so that the qcow2 file can grow its length when new sectors are allocated.

Sure but you cannot write to an OVA anyway because it contains embedded checksums.

Rich.

Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
#67 lore raw
In reply to Dr. David Alan Gilbert
Quoted 64 lines · Dr. David Alan Gilbert
Quoted 63 lines · * Max Reitz ([email protected]) wrote:
Quoted 62 lines · Dr. David Alan Gilbert
Quoted 60 lines · * Max Reitz ([email protected]) wrote:
Quoted 44 lines · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

This seems to have fizzled out because of a lack of a concrete proposal; so here is one based on a reply to Max's post:

* Max Reitz ([email protected]) wrote:

<snip>

Quoted 8 lines

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture.

<snip>

Quoted 5 lines

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them?

<snip>

Quoted 4 lines

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

<snip>

Quoted 8 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would think (which may
support JSON at some point?). So basically we would store the data as
a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files. I hate the idea of making qcow2 a random archive format. We have tar for that.

Quoted 8 lines

<snip>

Quoted 3 lines

tl;dr: I really don't get why it's so hard to supply a config file along with a qcow2 image. Is it so hard for people to realize that a VM does not only consist of a disk?

Yes! Because in many cases that's all it needs, and it's ready to run with no unpacking.

It clearly is not, or we would not have this discussion.

The disk image is only enough if you want the default values for all of qemu's configuration options, because today (and if I were to decide, in the future, too) disk images do not configure the VM (well, they configure the guest, but not the VM itself).

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The problem with having a separate file is that you either have to copy it around with the image

Which is just an inconvenience.

It's more than that; if it's a separate file then the tools can't rely on users supplying it, and frankly they won't and they'll still just supply an image.

At which point you throw an error and tell them to specify the config file.

Quoted 19 lines
Quoted 3 lines

I understand it is an inconvenience and it would be nice to change it, but please understand that I do not want qcow2 to become a filesystem just to relieve an inconvenience.

I very much don't want it to be a filesystem; my reason for writing down my spec the way I did was to make it clear that the only thing I want of qcow2 is a single blob, no more; I don't want naming of the blob or anything else.

Quoted 2 lines

(Note: I understand that you may not want qcow2 to become a filesystem, but I do get the impression from others.)

My aim was to specify it to fulfill the requirements that everyone else had asked for, but still only having one unmodifiable blob in qcow.

Quoted 4 lines
Quoted 3 lines

or have an archive. If you have an archive
you have to have an unpacking step which then copies, potentially a lot of data taking some reasonable amount of time.

Quoted 8 lines
Quoted 5 lines

I'm sure this can be optimized, but yes, I get that.

(If you use e.g. tar and store the image data starting on an FS cluster boundary (64 kB should be more than sufficient), I assume there is a way to extract that data into a new file without copying anything.)

But then we have to modify all the current things that know how to handle a qcow2.

Not in this case because it'd still be a flat qcow2 file in a simple tar archive.

But you're right if we had a more complex format (like chunks stored in a tar file).

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Storing a simple bit
of data with the image avoids that.

It is not a simple bit of data, as evidenced by the discussion about storing binary blobs and MIME types going on.

All of the things they've suggested can be done inside that one blob; even inside the json (or any other structure in that blob).

Right, from qcow2's perspective it's a blob of data. But you can put a whole filesystem into a blob of data, and I get the impression that this is what some are trying to do.

Once we store larger amounts of binary data in that blob (which is what I'm fearing from comments on MIME types and PNG images), people will realize that always having to re-store the whole blob if you modify something in the middle is inefficient and that it needs to be optimized. I don't think you want to do that, but we haven't implemented any of this yet and people are already asking for such binary data inside of the blob.

I suspect it'll only get worse over time.

I think the most difficult thing about this discussion is that there are different targets.

You just want to store a bit of information. OK, good, but then I'd say we could even just prepend that to the image file in a small header.

(Note that extending that header would not even be too complicated, because you can easily move the qcow2 header somewhere else. Say you move it back by one cluster (e.g. 64 kB), then you just put the cluster that was there originally to the end of the file, which is pretty much trivial. Then you copy that original data there and overwrite it with the image header. Done.)

Others want to store more binary data. Then this may get inefficient and insufficient. But I'd think at this point it gets really problematic to put the data into the qcow2 file because it really doesn't belong there. (I can't imagine anything that would warrant a MIME type.)

Then I've heard proposals of storing multiple disk images. Yes, you could store multiple disks inside of a single qcow2 file, but it would be basically exactly the same as storing just multiple qcow2 files, so...

And really, I still believe in my slippery slope argument, which means that even if you just want to innocently store a machine type, we will end up with something vastly more complex in the end.

Finally, it appears to me that you have a simple problem, found one possible solution, and now you just focus on that solution instead of taking a step back and looking at the problem again.

The problem: You want to store a binary blob and a disk image together.

Your solution: qcow2 has refcounting and thus "occupation bits". You can put data into it and it will leave it alone, as long as that area is marked as occupied. Let's put the data into the qcow2 file.

OK, let's look at the problem and its constraints again.

Hard constraint: Store a single file.
(I don't think this is a hard constraint, because I haven't been convinced yet that handling more than a single file is so bad.)

Soft constraint: Max doesn't like storing blobs in qcow2.

So one solution is to ignore the soft constraint. OK, valid solution, I give you that. But it doesn't leave me content, probably understandably so.

So let me try to understand how we end up with qcow2 as a result... We need a single file that needs to contain both the disk data and a binary blob. Or, well, even better would be if that file can store multiple arbitrary objects, in a format of your choosing, but that makes things more complicated, so let's leave that off for now.

So all you need is object storage (probably with a single root object that references the rest in a custom format) and a way to tell which areas of the file are occupied. Now the issue is that both the disk image and the blob may grow. So both need mutual understanding of which areas are occupied and which can be used for growth. For the disk image, the block layer would definitely need a driver to handle that, which is not impossible. But qcow2 would automatically handle it.

So, OK, for now this is my result. If we create a new format, we'd need a block driver for it (underneath qcow2) that handles the allocation. With qcow2, we'd get it for free.

Hm, OK.

The simplest implementation for such an additional layer would get away without actual occupation bits and just always allocate new storage at the end of the file. That should be sufficient, it would be quick and not very complex. But I see that it is additional complexity when compared with just adding the blob to qcow2.

Well, in a sense, because we'd need block layer interfaces for extracting the information from a qcow2 file through qemu-img. So maybe adding another block driver would actually mean less complexity...

[...]

Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

But I really, really, really do not like storing arbitrary data in qcow2 files. I hated it badly enough when qemu knew what to do with it, but I hate it even more when even qemu has no idea what to do with it.

Having a specification of what everything means in the qemu tree makes things less unbearable, but not to my liking still.

Quoted 6 lines
Quoted 2 lines

Have you said why you hate it so much?
Your hate for it seems to be making a simple solution hard.

Because it's a disk image format. Data therein should be relevant to the disk image. I see qcow2 as a representation of data stored on a physical storage medium.

Quoted 5 lines

What we're missing here is the notes scribbled on the sticky label on the disc; you rarely need them on a physical drive in a computer, LUNs on a SAN don't need them that much because they have a full filesystem and don't move about much. Here we're talking about an image being downloaded or sent between people.

Well, qcow2 doesn't even describe the device type, so the sticky label may be off limits.

But really, if you create a VM, you need a configuration. Like if you set up a new computer, you need to know what you want. Usually there is no sticky label, but you just have to know and input it manually. Maybe you have a sheet of paper, which I'd call the configuration file.

Quoted 19 lines
Quoted 13 lines

Some metadata associated directly with that is fine (such as dirty bitmaps, backing chains, things like that). But configuring the whole VM seems out of scope to me.

Also, making qcow2 a filesystem is not a simple solution.

...OK, let me back off here, I may be over-interpreting things and throwing opinions of different people into one pot.

Maybe you don't want qcow2 to be a filesystem, and you just want to store a single binary blob. Well, OK, that's not that bad. But in any case, I wouldn't call it a simple solution anymore.

Quoted 5 lines

Yes, storing just the machine type somewhere would be possible with a simple solution; but as I said (and the whole thread shows since then), this is a slippery slope, and suddenly we arrive at storing arbitrary binary data (like images?!) along with MIME types. That will not be possible with a simple solution anymore, I don't think.

Quoted 3 lines

Right; I was thinking we were too far down that slope to get rid of all of those requirements, but I was trying to force it back to being a single blob as far as QCOW2 saw it.

A valiant effort, but I myself cannot see why we should forbid storing more data once we started storing some data. I myself do think that if we store some VM configuration, we should be able to store all of it, and allow for arbitrarily complex scenarios.

Quoted 33 lines
Quoted 33 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.

Yes, but in the process you've made it completely opaque to qemu, basically, which doesn't really make it better for me. Not that qemu-specific information in qcow2 files would be what I want, but, well.

But it does solve technical issues, I concede that.

Quoted 3 lines

b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.

Quoted 7 lines
Quoted 3 lines

Not really. The string can be rather long, so you probably don't want to store it in the image header, and thus it's just a binary blob from qcow2's perspective, essentially.

Yes, but it's a single blob - I'm not asking for multiple keyed blobs or the ability to update individual blobs; just one blob that I can replace.

OK, you aren't, but others seem to be.

Or, well, you call it a single blob. But actually the current ideas seem to be to store a rather large configuration tree with binary data in that blob, so to me personally there is absolutely no functional difference to just storing a tar file in that blob.

Quoted 8 lines
Quoted 3 lines

So correct me if I'm wrong, but to me it appears that you effectively want to store a filesystem in qcow2.[1] Well, that's better than making qcow2 the filesystem, but it still appears just the wrong way around to me.

It's different in the sense that what we end up with is still a qcow2; anything that just handles qcow2's and can pass them through doesn't need to do anything different; users don't need to do anything different. No one has to pack/unpack the file.

Packing/unpacking is a strawman because I'm doing my best to give proposals that completely avoid that.

Users do need to do something different, because users do need to realize that today there is no way to store VM configuration and disk data in a single file. So if they already start VMs just based on a disk, then they are assuming behavior we do not have and that I'd call naive. But that is a strawman from my side, sorry. Keeping naive users happy is probably OK.

Keeping tools working is a good argument, but I'm not exactly sure what the use cases are. What I'd want is that in the end we have a way of configuring a whole VM in a single file.[1] Then, that file is no longer just a disk image, it is a whole VM. So maybe those tools need to be adjusted anyway.

I assume that we have tools that work on disk images, and we trivially want to keep them working on that VM's disk image without having to incorporate a block layer. Depending on the format we choose, that may be very simple (maybe just use an offset for the qcow2 header).

But if we want to store a whole VM in a single file, then storing multiple disk images in that single file does not seem too far off to me, and that would mean breaking those tools anyway.

[1] I still don't quite see the point, because just using more than a single file is so much easier.

Quoted 29 lines
Quoted 29 lines

[1] Yes, I know that the guest disk already contains an FS. :-P

Quoted 15 lines
Quoted 15 lines
Quoted 11 lines

(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024

I still don't understand why you'd want to put the configuration into qcow2 instead of the other way around.

Quoted 7 lines
Quoted 5 lines

Or why you'd want to use a single file at all, because as this whole thread shows, a disk image alone is clearly not sufficient to describe a VM.

(Or it may be in simple cases, but then that's because you don't need any configuration.)

Because it avoids the unpacking associated with archives.

I'm not talking about unpacking. I'm talking about a potentially new format which allows accessing the qcow2 file in-place. It would probably be trivial to write a block driver to allow this.

Quoted 6 lines
Quoted 2 lines

(And as I wrote in my response to Michal, I suspect that tar could actually allow this, even though it would probably not be the ideal format.)

As above, I don't think this is trivial; you have to change all the layers; lets say it was a tar; you'd have to somehow know that you're importing one of these special tars,

Which is trivial because it's just "Hey, look, it's a tar with that description file".

Quoted 2 lines

you also have to have a tool to
create them;

Also trivial. Non-trivial is modifying them.

The workflow would be to create the tar with an empty qcow2 file, the VM description you want, and then just using it.

Yes, using is more difficult, but it wouldn't be an own tool, it would be built into qemu. I can't say how difficult that implementation would be, but it would not be trivial, that is correct.

Quoted 2 lines

and you have to worry about whether that alignment
is correct for the storage/memory you're using it with.

Which would be difficult with tar, right. But we don't have to use tar.

(And, no, I don't think creating a new container format is not worse for interoperability than adding a blob to qcow2.)

Max

#140 lore raw
In reply to Michal Suchánek
Quoted 10 lines · Michal Suchánek
Quoted 7 lines · On Wed, 6 Jun 2018 13:52:35 +0200 Max Reitz <[email protected]> wrote:
Quoted 6 lines · Michal Suchánek
Quoted 3 lines · On Wed, 6 Jun 2018 13:32:47 +0200 Max Reitz <[email protected]> wrote:
Quoted 2 lines · Michal Suchánek

On Wed, 6 Jun 2018 13:02:53 +0200
Max Reitz <[email protected]> wrote:

[...]

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

What I'm trying to get at is that qcow2 was not designed to be a container format for arbitrary files. If you want to make it such, I'm sure there are existing formats that work better.

Such as?

ext2?

So you want an ext2 driver in qemu instead of expanding qcow2 to work not only for a single disk but also for an appliance?

Quoted 8 lines
Quoted 4 lines

Yes, because ext2 was designed to be a proper filesystem. I'm not an FS designer. Well, not a good one anyway. So I don't trust myself on extending qcow2 to be a good FS -- and why would I, when there are already numerous FS around.

Do you expect that performance of qemu using qcow2 driver over ext2 driver will be better than using qcow driver directly with some part semi-permanently occupied by a configuration blob? My bet is not.

If you want to store multiple disk images in a single file? I would think so, yes. With qcow2, I would assume it leads to fragmentation. I would hope that proper filesystems can mitigate this.

Quoted 5 lines

The ext* drivers are designed to work with kernel VM infrastructure which must be tuned for different usage scenarios and you would have to duplicate that tuning in qemu to get competitive performance. Also you get qcow2 and ext2 metadata which must be allocated, managed, etc. You get more storage and performance overhead for no good reason.

Yes, there is a good reason. You can add arbitrary configuration options without having to worry about me.

Seriously, though, a real FS would allow you to be more expressive and really do what you want without having to work around the quirks that adding a not-real-FS in the most simple way possible to qcow2 would bring with it.

Because this is part of my fear, that we now add a very simple blob for just a sprinkle of data. But over time it gets more and more complex because we want to store more and more data to make things ever more convenient[1], we notice that we need more features, the format gets more complex, and in the end we have an FS that is just worse than a real FS.

[1] And note that if I'm convinced to store VM configuration data in qemu, I will agree that we can store any data in there and it would be nice if any VM could be provisioned and used that way.

Quoted 4 lines

On the other hand, qcow is designed for storing VM disk data and hopefully was tuned to do that decently over the years. The primary use case remains storing VM disk data. Adding a configuration blob does not change that.

True. So the argument is that qcow2 may be worse for storing arbitrary data, but we don't have performance requirements for that; but we do have performance requirements for disk data and adding another format below qcow2 will not make it better.

I do think it is possible to not make things worse with a format under qcow2, but that may require additional complexity, that you think is pointless.

I understand that you think that, but I still believe that putting the configuration into qcow2 is just the wrong way around and will fall on our feet in the long run.

Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Quoted 26 lines
Quoted 14 lines
Quoted 14 lines
Quoted 10 lines
Quoted 4 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

Quoted 8 lines
Quoted 4 lines

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

qemu cannot read the disk data from the file in-place.

Hu? Why not?

Well, it can possibly read the image if it happens to be continuous. It will not be able to update it without a fs driver, however.

Yes, but first, such an FS driver would be possible (and as long as we don't need real complexity, it could be very simple, like just using an offset in a tar file and then just adjust the file length field on allocations beyond the EOF).

And secondly, I think adding another format has the advantage of easier deprecation. If we think we need something more complex, we are free to design that and throw away the old format. But if we add something to qcow2, I would think it is there to stay.

So, yes, for qcow2 we might want to design something (overly?) complex from that start that we hope will fulfill all our needs (which it won't, because things never turn out that way). But if we'd add a new format, we could keep it simple in the beginning and start over later.

Max

#111 lore raw
In reply to Dr. David Alan Gilbert
Quoted 13 lines · Dr. David Alan Gilbert
Quoted 12 lines · * Daniel P. Berrangé ([email protected]) wrote:
Quoted 10 lines · Richard W.M. Jones
Quoted 5 lines · Dr. David Alan Gilbert

The problem with having a separate file is that you either have to copy it around with the image or have an archive. If you have an archive you have to have an unpacking step which then copies, potentially a lot of data taking some reasonable amount of time. Storing a simple bit of data with the image avoids that.

This isn't really true. For OVA (ie. tar) we don't unpack them. Adding file.offset and file.size in qemu's raw driver was crucial to that optimization.

Quoted 6 lines
Quoted 3 lines

Though that assumes you're only using the qcow2 file in read-only mode. As soon as you need write access you need to unpack from the OVA so that the qcow2 file can grow its length when new sectors are allocated.

And the person creating the OVA has to do that taring rather than just take the qcow2 they've just used in the VM.

Note that this again can be done efficiently. You just overwrite the beginning of the qcow2 file and move the overwritten clusters somewhere else.

Max

#121 lore raw
In reply to Dr. David Alan Gilbert
Quoted 41 lines · Dr. David Alan Gilbert
Quoted 40 lines · * Max Reitz ([email protected]) wrote:
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 7 lines · * Max Reitz ([email protected]) wrote:
Quoted 6 lines · Michal Suchánek
Quoted 3 lines · On Wed, 6 Jun 2018 13:02:53 +0200 Max Reitz <[email protected]> wrote:
Quoted 2 lines · Michal Suchánek

On Tue, 29 May 2018 12:14:15 +0200
Max Reitz <[email protected]> wrote:

[...]

Quoted 27 lines
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 10 lines
Quoted 4 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Quoted 5 lines
Quoted 2 lines

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

Because then we'd have to change the whole stack to take advantage of that. Adding a feature into qcow2 means nothing else changes.

Quoted 8 lines
Quoted 4 lines

Because it's a hack, right. Storing binary data in a qcow2 file, completely ignoring it in qemu (and being completely unusable to any potential other users of the qcow2 format[1]) and only interpreting it somewhere up the stack is a hack.

It's not a hack!
Seriously it's not.
There's nothing wrong with it being aimed higher up the stack than qemu,

Not really, but storing that information in a disk image file is, from my perspective. So far, qcow2 was always just for qemu. (Hmm... Maybe backing links weren't, but at least they were intended for qemu originally.)

So this would mix information for different layers inside qcow2 which to me sounds weird. Maybe I just have to get used to it.

Quoted 2 lines

the problem we started off with was what happens when a user downloads a VM image and tries to import it into their VM system;

Well, the VM system should choke without a config file. O:-)

Quoted 3 lines

weve already
got 2+ layers of management stuff in there - I want the information to guide those layers, not form a complete set of configuration.

But I do.

If we store some information, I don't see why we don't store all of it.

Quoted 5 lines
Quoted 5 lines

That is not necessarily a negative point, hacks can work wonderfully well, and they usually are simple, that is correct. But the thing is that I feel like people have grand visions of what to get out of this. Imagine, a single file that can configure all and any VM!

Quoted 8 lines
Quoted 5 lines

But hacks usually only solve a single issue. Once you try to extend a hack, it breaks down and becomes insufficient.

If we want a grand vision where a single file stores the whole VM, why not invest the work and make it right from the start?

Because we won't get it right; however much we bikeshed about it we'll just end up with a mess.

Sure, but the same thing applies to putting it into qcow2. The difference is, for something outside of qcow2, throwing it away and starting over is simple.

When putting it into qcow2, we can only do that if we really just put a binary blob there that isn't described in the specification.

Quoted 3 lines

The right thing is to put in something
to hold configuration and then review the items of configuration we add properly as we define them.

OK, but review them on what terms? Whether they are simple enough?

As I said, I would want a whole configuration if we allow some configuration.

(More below)

Quoted 6 lines
Quoted 3 lines

[1] Yes, I concede that there are probably no other users of qcow2. But please forgive me for assuming that qcow2 was in a sense designed to be a rather general image format that not only qemu could use.

What makes it QEMU specific? It's basically just the same key/value setup as OVA, except putting them inside the qcow2.

Well, not necessarily qemu-specific, but ${management_software}-specific, which comes down to the same. Or, well, I'd think that, but hold on.

Quoted 2 lines

We could use the same keys/value definitions as OVA in the blob, although their definitions aren't very portable either.

So you're proposing that we only add options that seem portable for any VM?

Max

#62 lore raw
In reply to Dr. David Alan Gilbert
Quoted 104 lines · Dr. David Alan Gilbert
Quoted 89 lines · * Eduardo Habkost ([email protected]) wrote:
Quoted 67 lines · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

This seems to have fizzled out because of a lack of a concrete proposal; so here is one based on a reply to Max's post:

* Max Reitz ([email protected]) wrote:

<snip>

Quoted 8 lines

The original problem was that you need to supply a machine type to qemu, and that multiple common architectures now have multiple machine types and not necessarily all work with a single image. So far so good, but I have two issues here already:

(1) How is qemu supposed to interpret that information? If it's stored in the image file, I don't see a nice way of retrieving it before the machine is initialized, at least not with qemu's current architecture.

<snip>

Quoted 5 lines

(2) Again, I personally just really don't like saving such information in a disk image. One actual argument I can bring up for that distaste is this: Suppose, you have multiple images attached to your VM. Now the VM wants to store the machine type. Where does it go? Into all of them?

<snip>

Quoted 4 lines

So I think if we decide to store the machine type, that is kind of a slippery slope and then there are good arguments for storing even more configuration options in the file, too. But I really, really don't like that.

<snip>

Quoted 8 lines

For another, how do we store the data? key-value seems wrong if we want to store everything. JSON might be fine. But eventually we just want basically a qemu configuration file in there, I would think (which may
support JSON at some point?). So basically we would store the data as
a binary blob and let the rest of qemu do its thing with it. But then please tell me why I fought so valiantly against storing random bitmaps in qcow2 files. I hate the idea of making qcow2 a random archive format. We have tar for that.

<snip>

Quoted 3 lines

tl;dr: I really don't get why it's so hard to supply a config file along with a qcow2 image. Is it so hard for people to realize that a VM does not only consist of a disk?

Yes! Because in many cases that's all it needs, and it's ready to run with no unpacking.

I think we should have:

--------------------------------------------------------------
Layer 0:
QCOW provides a way to store a single string of arbitrary (but
limited?) length.
QCOW provides a way to replace the string by a new string. The original or the new string will be stored after that; never some mix.
Where a file 'b' has a backing file 'a', 'b' inherits the string from 'a' unless 'b' has it's own string. Snapshots inherit their string from the main unless they have their own string.

Quoted 7 lines

Layer 1:
The string shall always be a JSON 'object'; i.e. of the form

    { "something": ... , "more": ... }

The key strings shall be non-null and non-empty and shall be unique.

I'd prefer layer 0+1 to:

1) Allow multiple entries to be stored (implemented by layer 1 in this proposal)
2) Identify each entry with a name (implemented by layer 1 in this proposal)
3) Allow arbitrary binary data to be stored on an entry (not possible with the JSON-based proposal, because JSON strings are not blobs, but Unicode strings).
4) Make it easy to replace only one entry while keeping others intact (not the case here, if all entries are stored in the same JSON string)

Quoted 7 lines

I think it would be simpler if layer 0 simply provided a list of names/value pairs, where names are ascii strings, and values are binary data[1]. It would make layer 1 unnecessary, and allow (3) and (4) to happen.

[1] In other words, Rich's proposal of "named blobs":
https://www.mail-archive.com/[email protected]/msg37856.html

My reasoning was just one of simplicity; each layer in this is almost trivial.
The downside to my proposal is it's more expensive if you want to change a single key; but as yet no one has suggested why we'd want to do it frequently enough to worry.

Quoted 5 lines

My suggestion of JSON was just to try and stop the bikeshedding; we seem to be putting a lot of effort into inventing a new storage definition for something that so far we need to hold one rarely changing short string, which even with all the discussion has moved upto maybe 3 or 4 rarely changing pieces of data.

I agree with that feeling, and I don't have a very strong preference.

I would prefer if qcow2 let us store named blobs, because it gives us more flexibility to decide about the data format later. But if qcow2 maintainers tell us it's much simpler to let us store a single string instead of named blobs, I won't complain too loudly if we follow your suggestion.

Signature · 1 line
Eduardo
#131 lore raw
In reply to Max Reitz
Quoted 50 lines · Max Reitz
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 7 lines · * Max Reitz ([email protected]) wrote:
Quoted 6 lines · Michal Suchánek
Quoted 3 lines · On Wed, 6 Jun 2018 13:02:53 +0200 Max Reitz <[email protected]> wrote:
Quoted 2 lines · Michal Suchánek

On Tue, 29 May 2018 12:14:15 +0200
Max Reitz <[email protected]> wrote:

[...]

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 10 lines
Quoted 4 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

Because then we'd have to change the whole stack to take advantage of that. Adding a feature into qcow2 means nothing else changes.

Because it's a hack, right. Storing binary data in a qcow2 file, completely ignoring it in qemu (and being completely unusable to any potential other users of the qcow2 format[1]) and only interpreting it somewhere up the stack is a hack.

That is not necessarily a negative point, hacks can work wonderfully well, and they usually are simple, that is correct. But the thing is that I feel like people have grand visions of what to get out of this. Imagine, a single file that can configure all and any VM!

Quoted 5 lines

But hacks usually only solve a single issue. Once you try to extend a hack, it breaks down and becomes insufficient.

If we want a grand vision where a single file stores the whole VM, why not invest the work and make it right from the start?

We don't want a grand vision where a single file stores the whole VM. This is exactly what I would like to avoid, by not inventing a whole different appliance file format.

Signature · 1 line
Eduardo
#141 lore raw
In reply to Max Reitz
Quoted 31 lines · On Wed, 6 Jun 2018 15:14:03 +0200 Max Reitz <[email protected]> wrote:
Quoted 10 lines · Michal Suchánek
Quoted 7 lines · On Wed, 6 Jun 2018 13:52:35 +0200 Max Reitz <[email protected]> wrote:
Quoted 6 lines · Michal Suchánek
Quoted 3 lines · On Wed, 6 Jun 2018 13:32:47 +0200 Max Reitz <[email protected]> wrote:
Quoted 2 lines · Michal Suchánek

On Wed, 6 Jun 2018 13:02:53 +0200
Max Reitz <[email protected]> wrote:

[...]

Quoted 17 lines
Quoted 16 lines
Quoted 11 lines
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

What I'm trying to get at is that qcow2 was not designed to be a container format for arbitrary files. If you want to make it such, I'm sure there are existing formats that work better.

Such as?

ext2?

So you want an ext2 driver in qemu instead of expanding qcow2 to work not only for a single disk but also for an appliance?

Yes, because ext2 was designed to be a proper filesystem. I'm not an FS designer. Well, not a good one anyway. So I don't trust myself on extending qcow2 to be a good FS -- and why would I, when there are already numerous FS around.

Quoted 7 lines
Quoted 3 lines

Do you expect that performance of qemu using qcow2 driver over ext2 driver will be better than using qcow driver directly with some part semi-permanently occupied by a configuration blob? My bet is not.

If you want to store multiple disk images in a single file? I would think so, yes. With qcow2, I would assume it leads to fragmentation.

How is that different from single disk divided into two partitions internally (without any knowledge on the qcow2 level)?

Quoted 1 line

I would hope that proper filesystems can mitigate this.

Not really. Not without much complexity and repeated maintenance.

Quoted 9 lines
Quoted 6 lines

The ext* drivers are designed to work with kernel VM infrastructure which must be tuned for different usage scenarios and you would have to duplicate that tuning in qemu to get competitive performance. Also you get qcow2 and ext2 metadata which must be allocated, managed, etc. You get more storage and performance overhead for no good reason.

Yes, there is a good reason. You can add arbitrary configuration options without having to worry about me.

But I will not be able to use the images in qemu so it will be useless.

Well, there is FUSE and that is certainly blazing fast and ubiquitous, I am sure.

Quoted 27 lines

Seriously, though, a real FS would allow you to be more expressive and really do what you want without having to work around the quirks that adding a not-real-FS in the most simple way possible to qcow2 would bring with it.

Because this is part of my fear, that we now add a very simple blob for just a sprinkle of data. But over time it gets more and more complex because we want to store more and more data to make things ever more convenient[1], we notice that we need more features, the format gets more complex, and in the end we have an FS that is just worse than a real FS.

[1] And note that if I'm convinced to store VM configuration data in qemu, I will agree that we can store any data in there and it would be nice if any VM could be provisioned and used that way.

Quoted 4 lines

On the other hand, qcow is designed for storing VM disk data and hopefully was tuned to do that decently over the years. The primary use case remains storing VM disk data. Adding a configuration blob does not change that.

True. So the argument is that qcow2 may be worse for storing arbitrary data, but we don't have performance requirements for that; but we do have performance requirements for disk data and adding another format below qcow2 will not make it better.

Quoted 7 lines

I do think it is possible to not make things worse with a format under qcow2, but that may require additional complexity, that you think is pointless.

I understand that you think that, but I still believe that putting the configuration into qcow2 is just the wrong way around and will fall on our feet in the long run.

I think that *if* we want an 'appliance' format that stores a whole VM in a single file to ease VM distribution then the logical place to look in qemu is qcow. The reason have been explained at length.

I understand that for some use cases simplifying the distribution of VMs as much as possible is quite important.

Quoted 32 lines
Quoted 32 lines
Quoted 31 lines
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 12 lines
Quoted 11 lines
Quoted 5 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Quoted 7 lines

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

Quoted 5 lines
Quoted 3 lines

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

qemu cannot read the disk data from the file in-place.

Hu? Why not?

Quoted 8 lines
Quoted 3 lines

Well, it can possibly read the image if it happens to be continuous. It will not be able to update it without a fs driver, however.

Yes, but first, such an FS driver would be possible (and as long as we don't need real complexity, it could be very simple, like just using an offset in a tar file and then just adjust the file length field on allocations beyond the EOF).

As said this will cover only the simplest case with readonly configuration blob(s) and one disk image at the end. The solution is obsolete even as we are designing it.

Quoted 5 lines

And secondly, I think adding another format has the advantage of easier deprecation. If we think we need something more complex, we are free to design that and throw away the old format. But if we add something to qcow2, I would think it is there to stay.

And then we would better add something general enough to work for foreseeable future or not add anything at all.

Quoted 7 lines

So, yes, for qcow2 we might want to design something (overly?) complex from that start that we hope will fulfill all our needs (which it won't, because things never turn out that way). But if we'd add a new format, we could keep it simple in the beginning and start over later.

Yes, you basically want something like a tar file that can interleave the archive members. Wait, isn't that a new filesystem?

Thanks

Michal

#142 lore raw
Quoted 4 lines · Michal Suchánek

I think that *if* we want an 'appliance' format that stores a whole VM in a single file to ease VM distribution then the logical place to look in qemu is qcow. The reason have been explained at length.

I rather disagree. This is a common problem beyond just QEMU and everyone just uses an existing archive format (TAR, ZIP) for bundling together one or more disk images, metdata for config, and whatever other resources are applicable for the vendor. This works with any disk format (raw, qcow2, vmdk, vpc, etc) so is preferrable to inventing someting that is specific to qcow2 IMHO.

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 :|
#122 lore raw
In reply to Max Reitz
Quoted 51 lines · * Max Reitz ([email protected]) wrote:
Quoted 41 lines · Dr. David Alan Gilbert
Quoted 40 lines · * Max Reitz ([email protected]) wrote:
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 7 lines · * Max Reitz ([email protected]) wrote:
Quoted 6 lines · Michal Suchánek
Quoted 3 lines · On Wed, 6 Jun 2018 13:02:53 +0200 Max Reitz <[email protected]> wrote:
Quoted 2 lines · Michal Suchánek

On Tue, 29 May 2018 12:14:15 +0200
Max Reitz <[email protected]> wrote:

[...]

Quoted 27 lines
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 10 lines
Quoted 4 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Quoted 5 lines
Quoted 2 lines

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

Because then we'd have to change the whole stack to take advantage of that. Adding a feature into qcow2 means nothing else changes.

Quoted 8 lines
Quoted 4 lines

Because it's a hack, right. Storing binary data in a qcow2 file, completely ignoring it in qemu (and being completely unusable to any potential other users of the qcow2 format[1]) and only interpreting it somewhere up the stack is a hack.

It's not a hack!
Seriously it's not.
There's nothing wrong with it being aimed higher up the stack than qemu,

Quoted 6 lines

Not really, but storing that information in a disk image file is, from my perspective. So far, qcow2 was always just for qemu. (Hmm... Maybe backing links weren't, but at least they were intended for qemu originally.)

So this would mix information for different layers inside qcow2 which to me sounds weird. Maybe I just have to get used to it.

The important point is it's explicitly for a different layer; we're not mixing it - the guest can never get to this information. It also saves the higher level management layers ever having to look at the data the guest can get to, which is a security advantage.

From my point of view, it really is the sticky label on the disc rather than the contents of it.

Quoted 5 lines
Quoted 2 lines

the problem we started off with was what happens when a user downloads a VM image and tries to import it into their VM system;

Well, the VM system should choke without a config file. O:-)

Quoted 7 lines
Quoted 3 lines

weve already
got 2+ layers of management stuff in there - I want the information to guide those layers, not form a complete set of configuration.

But I do.

If we store some information, I don't see why we don't store all of it.

Hmm, now that generally I don't like:
a) That really would make it hypervisor specific
b) It would be a lot of data
c) Generally, the supplier of an image doesn't know how the end-user wants it configured - although for some appliances they might.
d) Remember the only problem we had when we got here was how to stop the user shooting themselves in the foot by connecting the wrong image to the wrong VM type. So I'm expecting to use this to contain requirements, nothing more.

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines

That is not necessarily a negative point, hacks can work wonderfully well, and they usually are simple, that is correct. But the thing is that I feel like people have grand visions of what to get out of this. Imagine, a single file that can configure all and any VM!

Quoted 8 lines
Quoted 5 lines

But hacks usually only solve a single issue. Once you try to extend a hack, it breaks down and becomes insufficient.

If we want a grand vision where a single file stores the whole VM, why not invest the work and make it right from the start?

Because we won't get it right; however much we bikeshed about it we'll just end up with a mess.

Quoted 6 lines

Sure, but the same thing applies to putting it into qcow2. The difference is, for something outside of qcow2, throwing it away and starting over is simple.

When putting it into qcow2, we can only do that if we really just put a binary blob there that isn't described in the specification.

Well, it's why I'm going for defined key/values that are stored in the blob and only a few of them. We've got a reasonable chance of being able to define what we want from 3-4 key/values, it should be a lot easier than trying to define a grand scheme.

Quoted 5 lines
Quoted 3 lines

The right thing is to put in something
to hold configuration and then review the items of configuration we add properly as we define them.

OK, but review them on what terms? Whether they are simple enough?

Well, I'll take simple, make sense - whatever - feel free to be the maintainer for that list!

Quoted 2 lines

As I said, I would want a whole configuration if we allow some configuration.

Well then you could go for libvirt XML as the contents; but I think that's crossing layers even more.
(I would have veered more to it being exactly the same as an OVA description except for rjones dislike of it)

Quoted 9 lines

(More below)

Quoted 6 lines
Quoted 3 lines

[1] Yes, I concede that there are probably no other users of qcow2. But please forgive me for assuming that qcow2 was in a sense designed to be a rather general image format that not only qemu could use.

What makes it QEMU specific? It's basically just the same key/value setup as OVA, except putting them inside the qcow2.

Quoted 8 lines

Well, not necessarily qemu-specific, but ${management_software}-specific, which comes down to the same. Or, well, I'd think that, but hold on.

Quoted 2 lines

We could use the same keys/value definitions as OVA in the blob, although their definitions aren't very portable either.

So you're proposing that we only add options that seem portable for any VM?

Hmm. We should probably split them, so there should be general options (e.g. minimum-ram) but also hypervisor specifics (qemu.machine-class=q35); but that doesn't mean you can't add keys for multiple hypervisors into the one blob. I mean something like:
minimum-ram = 1G
qemu.machine-class = q35
anothervm.machine-class = ....

Dave

Quoted 2 lines

Max

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#143 lore raw
In reply to Daniel P. Berrangé
Quoted 6 lines · Daniel P. Berrangé
Quoted 4 lines · Michal Suchánek

I think that *if* we want an 'appliance' format that stores a whole VM in a single file to ease VM distribution then the logical place to look in qemu is qcow. The reason have been explained at length.

Quoted 6 lines

I rather disagree. This is a common problem beyond just QEMU and everyone just uses an existing archive format (TAR, ZIP) for bundling together one or more disk images, metdata for config, and whatever other resources are applicable for the vendor. This works with any disk format (raw, qcow2, vmdk, vpc, etc) so is preferrable to inventing someting that is specific to qcow2 IMHO.

Now we have N+1 appliance file formats. :)

(We like it or not, qcow2 is already used as an appliance format for single-disk VMs in practice.)

But I agree this must not be specific to qcow2. The same VM description format we agree upon should work with other disk formats or with multi-disk appliances.

If we specify a reasonable VM description format for appliances and make it work inside (e.g.) tar files, we will still have the option of allowing the description be placed inside qcow2 if we really want to. I don't think we need to finish this qcow2 bikeshedding exercise right now.

Signature · 1 line
Eduardo
#146 lore raw
In reply to Michal Suchánek
Quoted 38 lines · Michal Suchánek
Quoted 35 lines · On Wed, 6 Jun 2018 15:14:03 +0200 Max Reitz <[email protected]> wrote:
Quoted 10 lines · Michal Suchánek
Quoted 7 lines · On Wed, 6 Jun 2018 13:52:35 +0200 Max Reitz <[email protected]> wrote:
Quoted 6 lines · Michal Suchánek
Quoted 3 lines · On Wed, 6 Jun 2018 13:32:47 +0200 Max Reitz <[email protected]> wrote:
Quoted 2 lines · Michal Suchánek

On Wed, 6 Jun 2018 13:02:53 +0200
Max Reitz <[email protected]> wrote:

[...]

Quoted 20 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

What I'm trying to get at is that qcow2 was not designed to be a container format for arbitrary files. If you want to make it such, I'm sure there are existing formats that work better.

Such as?

ext2?

Quoted 7 lines
Quoted 2 lines

So you want an ext2 driver in qemu instead of expanding qcow2 to work not only for a single disk but also for an appliance?

Yes, because ext2 was designed to be a proper filesystem. I'm not an FS designer. Well, not a good one anyway. So I don't trust myself on extending qcow2 to be a good FS -- and why would I, when there are already numerous FS around.

Do you expect that performance of qemu using qcow2 driver over ext2 driver will be better than using qcow driver directly with some part semi-permanently occupied by a configuration blob? My bet is not.

Quoted 6 lines
Quoted 3 lines

If you want to store multiple disk images in a single file? I would think so, yes. With qcow2, I would assume it leads to fragmentation.

How is that different from single disk divided into two partitions internally (without any knowledge on the qcow2 level)?

From how it's going to be fragmented, there is no difference. If you have multiple partitions and write to them concurrently, thus allocating new areas, you get bad fragmentation.

Quoted 3 lines
Quoted 1 line

I would hope that proper filesystems can mitigate this.

Not really. Not without much complexity and repeated maintenance.

Yes, a proper filesystem. Which we'd get for free with multiple files.

Quoted 11 lines
Quoted 9 lines
Quoted 6 lines

The ext* drivers are designed to work with kernel VM infrastructure which must be tuned for different usage scenarios and you would have to duplicate that tuning in qemu to get competitive performance. Also you get qcow2 and ext2 metadata which must be allocated, managed, etc. You get more storage and performance overhead for no good reason.

Yes, there is a good reason. You can add arbitrary configuration options without having to worry about me.

But I will not be able to use the images in qemu so it will be useless.

Neither can you with the current proposal because that is about adding management layer configuration options which are opaque to qemu.

Quoted 2 lines

Well, there is FUSE and that is certainly blazing fast and ubiquitous, I am sure.

If you want to use pre-existing drivers, you'd probably use a loop device.

Otherwise, you'd use the block layer for accessing the disk.

If you want blazingly fast, you probably won't use qcow2 anyway. Or, funnily enough, you'd want to probably split the qcow2 file into a metadata and a data file, so you get even more files. (But that is a proposal for the future.)

Quoted 30 lines
Quoted 30 lines

Seriously, though, a real FS would allow you to be more expressive and really do what you want without having to work around the quirks that adding a not-real-FS in the most simple way possible to qcow2 would bring with it.

Because this is part of my fear, that we now add a very simple blob for just a sprinkle of data. But over time it gets more and more complex because we want to store more and more data to make things ever more convenient[1], we notice that we need more features, the format gets more complex, and in the end we have an FS that is just worse than a real FS.

[1] And note that if I'm convinced to store VM configuration data in qemu, I will agree that we can store any data in there and it would be nice if any VM could be provisioned and used that way.

Quoted 4 lines

On the other hand, qcow is designed for storing VM disk data and hopefully was tuned to do that decently over the years. The primary use case remains storing VM disk data. Adding a configuration blob does not change that.

True. So the argument is that qcow2 may be worse for storing arbitrary data, but we don't have performance requirements for that; but we do have performance requirements for disk data and adding another format below qcow2 will not make it better.

I do think it is possible to not make things worse with a format under qcow2, but that may require additional complexity, that you think is pointless.

Quoted 7 lines
Quoted 3 lines

I understand that you think that, but I still believe that putting the configuration into qcow2 is just the wrong way around and will fall on our feet in the long run.

I think that *if* we want an 'appliance' format that stores a whole VM in a single file to ease VM distribution then the logical place to look in qemu is qcow. The reason have been explained at length.

The reason being that it's the easiest place, yes. That doesn't make it the best place.

Quoted 2 lines

I understand that for some use cases simplifying the distribution of VMs as much as possible is quite important.

I don't because still nobody has explained it to me.

The only explanation I got so far was "People are lazy and we have defaults for everything, so we don't throw an error if people forget to pass a configuration file."

Which to me still just makes it an inconvenience.

Quoted 35 lines
Quoted 35 lines
Quoted 34 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 11 lines
Quoted 10 lines
Quoted 4 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Quoted 7 lines

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

qemu cannot read the disk data from the file in-place.

Hu? Why not?

Well, it can possibly read the image if it happens to be continuous. It will not be able to update it without a fs driver, however.

Quoted 8 lines
Quoted 4 lines

Yes, but first, such an FS driver would be possible (and as long as we don't need real complexity, it could be very simple, like just using an offset in a tar file and then just adjust the file length field on allocations beyond the EOF).

As said this will cover only the simplest case with readonly configuration blob(s) and one disk image at the end. The solution is obsolete even as we are designing it.

As said this is not true because you can resize the configuration blob by restructuring the qcow2 file.

It is true for one disk image, but others apparently don't want an appliance file, so they only want a simple case where we only have one disk image.

I'm noticing a pattern here, and that is that everybody has a different opinion on what we actually want in the end, and it's just by chance that we find ourselves in two camps ("put it in qcow2" vs. "put it somewhere else").

Maybe we should first discuss what we actually want before we can discuss where to put it.

Quoted 7 lines
Quoted 4 lines

And secondly, I think adding another format has the advantage of easier deprecation. If we think we need something more complex, we are free to design that and throw away the old format. But if we add something to qcow2, I would think it is there to stay.

And then we would better add something general enough to work for foreseeable future or not add anything at all.

The intention is always to do everything right from the start, but that is rarely successful.

Quoted 9 lines
Quoted 6 lines

So, yes, for qcow2 we might want to design something (overly?) complex from that start that we hope will fulfill all our needs (which it won't, because things never turn out that way). But if we'd add a new format, we could keep it simple in the beginning and start over later.

Yes, you basically want something like a tar file that can interleave the archive members. Wait, isn't that a new filesystem?

Exactly. But I'd rather have this outside of qcow2 (and thus easily deprecatable) than inside.

(And if we just need to store something simple, we don't need such a filesystem, because then we can get away without fragmentation. But if we really need to grow the configuration options often, I suspect we'll want some allocation information and the like inside that blob in qcow2, too, so we'd end up with a filesystem there.)

Max

#144 lore raw
In reply to Eduardo Habkost
Quoted 23 lines · Eduardo Habkost
Quoted 6 lines · Daniel P. Berrangé
Quoted 4 lines · Michal Suchánek

I think that *if* we want an 'appliance' format that stores a whole VM in a single file to ease VM distribution then the logical place to look in qemu is qcow. The reason have been explained at length.

Quoted 6 lines

I rather disagree. This is a common problem beyond just QEMU and everyone just uses an existing archive format (TAR, ZIP) for bundling together one or more disk images, metdata for config, and whatever other resources are applicable for the vendor. This works with any disk format (raw, qcow2, vmdk, vpc, etc) so is preferrable to inventing someting that is specific to qcow2 IMHO.

Now we have N+1 appliance file formats. :)

(We like it or not, qcow2 is already used as an appliance format for single-disk VMs in practice.)

But I agree this must not be specific to qcow2. The same VM description format we agree upon should work with other disk formats or with multi-disk appliances.

Quoted 5 lines

If we specify a reasonable VM description format for appliances and make it work inside (e.g.) tar files, we will still have the option of allowing the description be placed inside qcow2 if we really want to. I don't think we need to finish this qcow2 bikeshedding exercise right now.

That actually sounds reasonable to me.

I better not think about it for too long so I don't come up with something I very much dislike about it.

(Well, now I have. The thing I still dislike is that we haven't talked about what we actually want in the end. Do we want just the very basic configuration options that are portable? But what really is the use case for such basic information? Won't people demand ever more configuration options, then? I certainly would.

And having to handle a full-blown config is probably a pain...)

Max

#145 lore raw
In reply to Eduardo Habkost
Quoted 23 lines · Eduardo Habkost
Quoted 6 lines · Daniel P. Berrangé
Quoted 4 lines · Michal Suchánek

I think that *if* we want an 'appliance' format that stores a whole VM in a single file to ease VM distribution then the logical place to look in qemu is qcow. The reason have been explained at length.

Quoted 6 lines

I rather disagree. This is a common problem beyond just QEMU and everyone just uses an existing archive format (TAR, ZIP) for bundling together one or more disk images, metdata for config, and whatever other resources are applicable for the vendor. This works with any disk format (raw, qcow2, vmdk, vpc, etc) so is preferrable to inventing someting that is specific to qcow2 IMHO.

Now we have N+1 appliance file formats. :)

(We like it or not, qcow2 is already used as an appliance format for single-disk VMs in practice.)

But I agree this must not be specific to qcow2. The same VM description format we agree upon should work with other disk formats or with multi-disk appliances.

Quoted 5 lines

If we specify a reasonable VM description format for appliances and make it work inside (e.g.) tar files, we will still have the option of allowing the description be placed inside qcow2 if we really want to. I don't think we need to finish this qcow2 bikeshedding exercise right now.

Yes, I think that is sensible, as once we actually try it out in real world cases, we might then find a tar/zip is sufficient after all and we don't need to do something extra for qcow2. Also means we can do experiments without committing to a qcow2 format spec change right away.

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 :|
#151 lore raw
In reply to Richard W.M. Jones
Quoted 6 lines · Richard W.M. Jones

I started off a long reply here, but I think you're right. If we cannot make people decide on and use a proper disk image + metadata container, then it's also unlikely we'll get them to add sensible metadata to their qcow2 images either :-(

Rich.

But we can do it for them: ask how to run image, store it in the image forever.

Signature · 1 line
MST
#68 lore raw
In reply to Max Reitz
Quoted 6 lines · * Max Reitz ([email protected]) wrote:
Quoted 5 lines · Dr. David Alan Gilbert
Quoted 4 lines · * Max Reitz ([email protected]) wrote:
Quoted 3 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Max Reitz ([email protected]) wrote:
Quoted 1 line · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

<snip>

Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The problem with having a separate file is that you either have to copy it around with the image

Which is just an inconvenience.

It's more than that; if it's a separate file then the tools can't rely on users supplying it, and frankly they won't and they'll still just supply an image.

At which point you throw an error and tell them to specify the config file.

No:
a) At the moment they get away with it for images since they're all 'pc' and the management layers do the right thing.
b) They'll give the wrong config file - then you'd need to add a flag to detect that - which means you'd need to add something to the qcow to match it to the config; loop back to teh start!

We should make this EASY for users.

Quoted 25 lines
Quoted 25 lines
Quoted 3 lines

I understand it is an inconvenience and it would be nice to change it, but please understand that I do not want qcow2 to become a filesystem just to relieve an inconvenience.

I very much don't want it to be a filesystem; my reason for writing down my spec the way I did was to make it clear that the only thing I want of qcow2 is a single blob, no more; I don't want naming of the blob or anything else.

Quoted 2 lines

(Note: I understand that you may not want qcow2 to become a filesystem, but I do get the impression from others.)

My aim was to specify it to fulfill the requirements that everyone else had asked for, but still only having one unmodifiable blob in qcow.

Quoted 9 lines
Quoted 3 lines

or have an archive. If you have an archive
you have to have an unpacking step which then copies, potentially a lot of data taking some reasonable amount of time.

I'm sure this can be optimized, but yes, I get that.

(If you use e.g. tar and store the image data starting on an FS cluster boundary (64 kB should be more than sufficient), I assume there is a way to extract that data into a new file without copying anything.)

Quoted 8 lines
Quoted 2 lines

But then we have to modify all the current things that know how to handle a qcow2.

Not in this case because it'd still be a flat qcow2 file in a simple tar archive.

But you're right if we had a more complex format (like chunks stored in a tar file).

My only problem with using the tar like that is that all tools everywhere would need to be updated to be able to parse them. (Note if adding a blob to qcow2 like I'm asking for would break existing qcow2 users then I don't want it either).

Quoted 21 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Storing a simple bit
of data with the image avoids that.

It is not a simple bit of data, as evidenced by the discussion about storing binary blobs and MIME types going on.

All of the things they've suggested can be done inside that one blob; even inside the json (or any other structure in that blob).

Right, from qcow2's perspective it's a blob of data. But you can put a whole filesystem into a blob of data, and I get the impression that this is what some are trying to do.

Once we store larger amounts of binary data in that blob (which is what I'm fearing from comments on MIME types and PNG images), people will realize that always having to re-store the whole blob if you modify something in the middle is inefficient and that it needs to be optimized. I don't think you want to do that, but we haven't implemented any of this yet and people are already asking for such binary data inside of the blob.

Quoted 6 lines

I suspect it'll only get worse over time.
I think the most difficult thing about this discussion is that there are different targets.

You just want to store a bit of information. OK, good, but then I'd say we could even just prepend that to the image file in a small header.

I think you're over-reading what people are asking for.
I think the PNG suggestion is again the 'label on the front' for a logo. I've not seen anything that's not for either:
a) The user to know what the image is
b) The management layer to know what type of VM to create

Quoted 7 lines

(Note that extending that header would not even be too complicated, because you can easily move the qcow2 header somewhere else. Say you move it back by one cluster (e.g. 64 kB), then you just put the cluster that was there originally to the end of the file, which is pretty much trivial. Then you copy that original data there and overwrite it with the image header. Done.)

Quoted 5 lines

Others want to store more binary data. Then this may get inefficient and insufficient. But I'd think at this point it gets really problematic to put the data into the qcow2 file because it really doesn't belong there. (I can't imagine anything that would warrant a MIME type.)

No, I can't imagine why anyone wants a MIME type either.

Quoted 3 lines

Then I've heard proposals of storing multiple disk images. Yes, you could store multiple disks inside of a single qcow2 file, but it would be basically exactly the same as storing just multiple qcow2 files, so...

No, completely agree.

Quoted 14 lines

And really, I still believe in my slippery slope argument, which means that even if you just want to innocently store a machine type, we will end up with something vastly more complex in the end.

Finally, it appears to me that you have a simple problem, found one possible solution, and now you just focus on that solution instead of taking a step back and looking at the problem again.

The problem: You want to store a binary blob and a disk image together.

Your solution: qcow2 has refcounting and thus "occupation bits". You can put data into it and it will leave it alone, as long as that area is marked as occupied. Let's put the data into the qcow2 file.

Quoted 5 lines

OK, let's look at the problem and its constraints again.

Hard constraint: Store a single file.
(I don't think this is a hard constraint, because I haven't been convinced yet that handling more than a single file is so bad.)

See above; I think it is.
My other hard contraint is that no tool has to change unless it wants to make use of the new data.

Quoted 61 lines

Soft constraint: Max doesn't like storing blobs in qcow2.

So one solution is to ignore the soft constraint. OK, valid solution, I give you that. But it doesn't leave me content, probably understandably so.

So let me try to understand how we end up with qcow2 as a result... We need a single file that needs to contain both the disk data and a binary blob. Or, well, even better would be if that file can store multiple arbitrary objects, in a format of your choosing, but that makes things more complicated, so let's leave that off for now.

So all you need is object storage (probably with a single root object that references the rest in a custom format) and a way to tell which areas of the file are occupied. Now the issue is that both the disk image and the blob may grow. So both need mutual understanding of which areas are occupied and which can be used for growth. For the disk image, the block layer would definitely need a driver to handle that, which is not impossible. But qcow2 would automatically handle it.

So, OK, for now this is my result. If we create a new format, we'd need a block driver for it (underneath qcow2) that handles the allocation. With qcow2, we'd get it for free.

Hm, OK.

The simplest implementation for such an additional layer would get away without actual occupation bits and just always allocate new storage at the end of the file. That should be sufficient, it would be quick and not very complex. But I see that it is additional complexity when compared with just adding the blob to qcow2.

Well, in a sense, because we'd need block layer interfaces for extracting the information from a qcow2 file through qemu-img. So maybe adding another block driver would actually mean less complexity...

[...]

Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

But I really, really, really do not like storing arbitrary data in qcow2 files. I hated it badly enough when qemu knew what to do with it, but I hate it even more when even qemu has no idea what to do with it.

Having a specification of what everything means in the qemu tree makes things less unbearable, but not to my liking still.

Quoted 6 lines
Quoted 2 lines

Have you said why you hate it so much?
Your hate for it seems to be making a simple solution hard.

Because it's a disk image format. Data therein should be relevant to the disk image. I see qcow2 as a representation of data stored on a physical storage medium.

Quoted 5 lines

What we're missing here is the notes scribbled on the sticky label on the disc; you rarely need them on a physical drive in a computer, LUNs on a SAN don't need them that much because they have a full filesystem and don't move about much. Here we're talking about an image being downloaded or sent between people.

Quoted 7 lines

Well, qcow2 doesn't even describe the device type, so the sticky label may be off limits.

But really, if you create a VM, you need a configuration. Like if you set up a new computer, you need to know what you want. Usually there is no sticky label, but you just have to know and input it manually. Maybe you have a sheet of paper, which I'd call the configuration file.

Most things are figurable-out by the management tools/defaults or are dependent on the whim of the user - we're only trying to stop the user doing things that wont work.
Simpler example; what stops you trying to put the PPC qcow image into your x86 VM system - nothing that I know of. I just want to stop the users shooting themselves in the foot.

Quoted 73 lines
Quoted 19 lines
Quoted 13 lines

Some metadata associated directly with that is fine (such as dirty bitmaps, backing chains, things like that). But configuring the whole VM seems out of scope to me.

Also, making qcow2 a filesystem is not a simple solution.

...OK, let me back off here, I may be over-interpreting things and throwing opinions of different people into one pot.

Maybe you don't want qcow2 to be a filesystem, and you just want to store a single binary blob. Well, OK, that's not that bad. But in any case, I wouldn't call it a simple solution anymore.

Quoted 5 lines

Yes, storing just the machine type somewhere would be possible with a simple solution; but as I said (and the whole thread shows since then), this is a slippery slope, and suddenly we arrive at storing arbitrary binary data (like images?!) along with MIME types. That will not be possible with a simple solution anymore, I don't think.

Quoted 3 lines

Right; I was thinking we were too far down that slope to get rid of all of those requirements, but I was trying to force it back to being a single blob as far as QCOW2 saw it.

A valiant effort, but I myself cannot see why we should forbid storing more data once we started storing some data. I myself do think that if we store some VM configuration, we should be able to store all of it, and allow for arbitrarily complex scenarios.

Quoted 33 lines
Quoted 33 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.

Yes, but in the process you've made it completely opaque to qemu, basically, which doesn't really make it better for me. Not that qemu-specific information in qcow2 files would be what I want, but, well.

But it does solve technical issues, I concede that.

Quoted 3 lines

b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.

Quoted 7 lines
Quoted 3 lines

Not really. The string can be rather long, so you probably don't want to store it in the image header, and thus it's just a binary blob from qcow2's perspective, essentially.

Yes, but it's a single blob - I'm not asking for multiple keyed blobs or the ability to update individual blobs; just one blob that I can replace.

OK, you aren't, but others seem to be.

Or, well, you call it a single blob. But actually the current ideas seem to be to store a rather large configuration tree with binary data in that blob, so to me personally there is absolutely no functional difference to just storing a tar file in that blob.

Quoted 8 lines
Quoted 3 lines

So correct me if I'm wrong, but to me it appears that you effectively want to store a filesystem in qcow2.[1] Well, that's better than making qcow2 the filesystem, but it still appears just the wrong way around to me.

It's different in the sense that what we end up with is still a qcow2; anything that just handles qcow2's and can pass them through doesn't need to do anything different; users don't need to do anything different. No one has to pack/unpack the file.

Packing/unpacking is a strawman because I'm doing my best to give proposals that completely avoid that.

Quoted 6 lines

Users do need to do something different, because users do need to realize that today there is no way to store VM configuration and disk data in a single file. So if they already start VMs just based on a disk, then they are assuming behavior we do not have and that I'd call naive. But that is a strawman from my side, sorry. Keeping naive users happy is probably OK.

Remember this all works fine now and has done for many years; it's the addition of q35 that breaks that assumption.
The users can already blidly pick up the qcow2 image and stuff it in and it all works; all I want is for that to keep working.

Quoted 50 lines

Keeping tools working is a good argument, but I'm not exactly sure what the use cases are. What I'd want is that in the end we have a way of configuring a whole VM in a single file.[1] Then, that file is no longer just a disk image, it is a whole VM. So maybe those tools need to be adjusted anyway.

I assume that we have tools that work on disk images, and we trivially want to keep them working on that VM's disk image without having to incorporate a block layer. Depending on the format we choose, that may be very simple (maybe just use an offset for the qcow2 header).

But if we want to store a whole VM in a single file, then storing multiple disk images in that single file does not seem too far off to me, and that would mean breaking those tools anyway.

[1] I still don't quite see the point, because just using more than a single file is so much easier.

Quoted 32 lines
Quoted 31 lines

[1] Yes, I know that the guest disk already contains an FS. :-P

Quoted 15 lines
Quoted 15 lines
Quoted 11 lines

(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024

I still don't understand why you'd want to put the configuration into qcow2 instead of the other way around.

Quoted 7 lines
Quoted 5 lines

Or why you'd want to use a single file at all, because as this whole thread shows, a disk image alone is clearly not sufficient to describe a VM.

(Or it may be in simple cases, but then that's because you don't need any configuration.)

Because it avoids the unpacking associated with archives.

I'm not talking about unpacking. I'm talking about a potentially new format which allows accessing the qcow2 file in-place. It would probably be trivial to write a block driver to allow this.

(And as I wrote in my response to Michal, I suspect that tar could actually allow this, even though it would probably not be the ideal format.)

Quoted 6 lines
Quoted 3 lines

As above, I don't think this is trivial; you have to change all the layers; lets say it was a tar; you'd have to somehow know that you're importing one of these special tars,

Which is trivial because it's just "Hey, look, it's a tar with that description file".

Trivial? It's taking 100+ mails to add a tag to a qcow2 file! Can you imagine what it takes to change libvirt, openstack, ovirt and the rest?

Quoted 12 lines
Quoted 2 lines

you also have to have a tool to
create them;

Also trivial. Non-trivial is modifying them.

The workflow would be to create the tar with an empty qcow2 file, the VM description you want, and then just using it.

Yes, using is more difficult, but it wouldn't be an own tool, it would be built into qemu. I can't say how difficult that implementation would be, but it would not be trivial, that is correct.

Quoted 7 lines
Quoted 2 lines

and you have to worry about whether that alignment
is correct for the storage/memory you're using it with.

Which would be difficult with tar, right. But we don't have to use tar.

(And, no, I don't think creating a new container format is not worse for interoperability than adding a blob to qcow2.)

If you were going to do this then you'd end up just using OVA. You couldn't justify yet another format.

Dave

Quoted 2 lines

Max

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#123 lore raw
In reply to Dr. David Alan Gilbert
Quoted 56 lines · Dr. David Alan Gilbert
Quoted 55 lines · * Max Reitz ([email protected]) wrote:
Quoted 41 lines · Dr. David Alan Gilbert
Quoted 40 lines · * Max Reitz ([email protected]) wrote:
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 7 lines · * Max Reitz ([email protected]) wrote:
Quoted 6 lines · Michal Suchánek
Quoted 3 lines · On Wed, 6 Jun 2018 13:02:53 +0200 Max Reitz <[email protected]> wrote:
Quoted 2 lines · Michal Suchánek

On Tue, 29 May 2018 12:14:15 +0200
Max Reitz <[email protected]> wrote:

[...]

Quoted 27 lines
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 10 lines
Quoted 4 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Quoted 5 lines
Quoted 2 lines

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

Because then we'd have to change the whole stack to take advantage of that. Adding a feature into qcow2 means nothing else changes.

Quoted 8 lines
Quoted 4 lines

Because it's a hack, right. Storing binary data in a qcow2 file, completely ignoring it in qemu (and being completely unusable to any potential other users of the qcow2 format[1]) and only interpreting it somewhere up the stack is a hack.

It's not a hack!
Seriously it's not.
There's nothing wrong with it being aimed higher up the stack than qemu,

Not really, but storing that information in a disk image file is, from my perspective. So far, qcow2 was always just for qemu. (Hmm... Maybe backing links weren't, but at least they were intended for qemu originally.)

Quoted 5 lines
Quoted 2 lines

So this would mix information for different layers inside qcow2 which to me sounds weird. Maybe I just have to get used to it.

The important point is it's explicitly for a different layer; we're not mixing it - the guest can never get to this information.

Neither can it get to bitmaps, but bitmaps are still for qemu.

Quoted 3 lines

It also saves
the higher level management layers ever having to look at the data the guest can get to, which is a security advantage.

Er, well, yes, but guessing configuration options from the guest disk contents is definitely a bad idea, I agree on that anyway.

Quoted 2 lines

From my point of view, it really is the sticky label on the disc rather than the contents of it.

Sure, which is why I wouldn't put it in qcow2. Content and meta-content is what qcow2 currently stores, but not how to use it.

Quoted 9 lines
Quoted 9 lines
Quoted 2 lines

the problem we started off with was what happens when a user downloads a VM image and tries to import it into their VM system;

Well, the VM system should choke without a config file. O:-)

Quoted 3 lines

weve already
got 2+ layers of management stuff in there - I want the information to guide those layers, not form a complete set of configuration.

Quoted 5 lines
Quoted 3 lines

But I do.

If we store some information, I don't see why we don't store all of it.

Hmm, now that generally I don't like:

Me neither.

Quoted 1 line

a) That really would make it hypervisor specific

Yes.

Quoted 1 line

b) It would be a lot of data

Yes.

Quoted 2 lines

c) Generally, the supplier of an image doesn't know how the end-user wants it configured - although for some appliances they might.

Well, yes. But just storing very basic information limits the use case to a very basic case anyway, doesn't it? So this wouldn't be worse.

Everything beyond a very basic use case can expect the user to take 30 seconds to download and pass a config file.

Quoted 3 lines

d) Remember the only problem we had when we got here was how to stop the user shooting themselves in the foot by connecting the wrong image to the wrong VM type.

Hm. How exactly is that shooting yourself in the foot? Won't it just not work?

Quoted 2 lines

So I'm expecting to use this to
contain requirements, nothing more.

I assumed you'd want to relieve users of having to specify config options in basic use cases. This is why I believed it would be natural to expand that scope.

So why is it so dangerous to connect a disk you just downloaded to e.g. the wrong machine type? I assumed it just wouldn't work and you'd try again, until you realized that maybe you should read the download description and do as it says ("download this config file, pass it").

Quoted 18 lines
Quoted 18 lines
Quoted 5 lines
Quoted 5 lines

That is not necessarily a negative point, hacks can work wonderfully well, and they usually are simple, that is correct. But the thing is that I feel like people have grand visions of what to get out of this. Imagine, a single file that can configure all and any VM!

Quoted 8 lines
Quoted 5 lines

But hacks usually only solve a single issue. Once you try to extend a hack, it breaks down and becomes insufficient.

If we want a grand vision where a single file stores the whole VM, why not invest the work and make it right from the start?

Because we won't get it right; however much we bikeshed about it we'll just end up with a mess.

Sure, but the same thing applies to putting it into qcow2. The difference is, for something outside of qcow2, throwing it away and starting over is simple.

Quoted 7 lines
Quoted 2 lines

When putting it into qcow2, we can only do that if we really just put a binary blob there that isn't described in the specification.

Well, it's why I'm going for defined key/values that are stored in the blob and only a few of them. We've got a reasonable chance of being able to define what we want from 3-4 key/values, it should be a lot easier than trying to define a grand scheme.

Yes, as long as we can agree on how we can justify to future generations why we really only want these very few very specific values.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

The right thing is to put in something
to hold configuration and then review the items of configuration we add properly as we define them.

OK, but review them on what terms? Whether they are simple enough?

Well, I'll take simple, make sense - whatever - feel free to be the maintainer for that list!

OK, none. :-P

It would need to be a very strict requirement, in any case. Just "simple" or "dense" do not suffice, because those can be stretched.

Quoted 7 lines
Quoted 2 lines

As I said, I would want a whole configuration if we allow some configuration.

Well then you could go for libvirt XML as the contents; but I think that's crossing layers even more.
(I would have veered more to it being exactly the same as an OVA description except for rjones dislike of it)

Well, the format doesn't really matter for now, I think it's most important to first talk about what kind of scope we want.

Quoted 18 lines
Quoted 9 lines

(More below)

Quoted 6 lines
Quoted 3 lines

[1] Yes, I concede that there are probably no other users of qcow2. But please forgive me for assuming that qcow2 was in a sense designed to be a rather general image format that not only qemu could use.

What makes it QEMU specific? It's basically just the same key/value setup as OVA, except putting them inside the qcow2.

Quoted 8 lines

Well, not necessarily qemu-specific, but ${management_software}-specific, which comes down to the same. Or, well, I'd think that, but hold on.

Quoted 2 lines

We could use the same keys/value definitions as OVA in the blob, although their definitions aren't very portable either.

So you're proposing that we only add options that seem portable for any VM?

Quoted 8 lines

Hmm. We should probably split them, so there should be general options (e.g. minimum-ram) but also hypervisor specifics (qemu.machine-class=q35); but that doesn't mean you can't add keys for multiple hypervisors into the one blob. I mean something like:
minimum-ram = 1G
qemu.machine-class = q35
anothervm.machine-class = ....

Well, and that's my issue. Once you have application-specific info, you can go wild. And I would go wild, without a reasonable and strict requirement that the information we want to store has to fulfill.

For the record, I would've liked it if you'd said "only portable options". But I would have replied that I would fear we'd still end up with someone saying "I'd like to store X and Y, let's just put them into the specification, then they are portable [even if only this stack supports them]" and we wouldn't really have won anything.

Max

#69 lore raw
In reply to Dr. David Alan Gilbert
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 5 lines

Not in this case because it'd still be a flat qcow2 file in a simple tar archive.

But you're right if we had a more complex format (like chunks stored in a tar file).

My only problem with using the tar like that is that all tools everywhere would need to be updated to be able to parse them.

I feel it is the opposite actually. By adding named blobs or custom strings to qcow2, we've effectively invented a new type of archive format, except apps cant use the normal unzip/tar tools/apis they already have. Instead they need to use qemu-img to read,add,remove blobs from qcow2. It is very compelling to use an existing archive format like tar/zip because every language has APIs for dealing with them and apps probably already do this for things like OVA.

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 :|
#124 lore raw
In reply to Max Reitz
Quoted 122 lines · * Max Reitz ([email protected]) wrote:
Quoted 56 lines · Dr. David Alan Gilbert
Quoted 55 lines · * Max Reitz ([email protected]) wrote:
Quoted 41 lines · Dr. David Alan Gilbert
Quoted 40 lines · * Max Reitz ([email protected]) wrote:
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 7 lines · * Max Reitz ([email protected]) wrote:
Quoted 6 lines · Michal Suchánek
Quoted 3 lines · On Wed, 6 Jun 2018 13:02:53 +0200 Max Reitz <[email protected]> wrote:
Quoted 2 lines · Michal Suchánek

On Tue, 29 May 2018 12:14:15 +0200
Max Reitz <[email protected]> wrote:

[...]

Quoted 27 lines
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 10 lines
Quoted 4 lines

Unless I have got something terribly wrong (which is indeed a possibility!), to me this proposal means basically to turn qcow2 into (1) a VM description format for qemu, and (2) to turn it into an archive format on the way.

And if you go all the way you can store multiple disks along with the VM definition so you can have the whole appliance in one file. It conveniently solves the problem of synchronizing snapshots across multiple disk images and the question where to store the machine state if you want to suspend it.

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

If you want to have a single VM description file that contains the VM configuration and some qcow2/raw/whatever files along with it for the guest disk data, sure, go ahead. But why does the format of the whole thing need to be qcow2?

Quoted 5 lines
Quoted 2 lines

Because then qemu can access the disk data from the image directly without any need for extraction, copying to different file, etc.

This does not explain why it needs to be qcow2. There is absolutely no reason why you couldn't use qcow2 files in-place inside of another file.

Because then we'd have to change the whole stack to take advantage of that. Adding a feature into qcow2 means nothing else changes.

Quoted 8 lines
Quoted 4 lines

Because it's a hack, right. Storing binary data in a qcow2 file, completely ignoring it in qemu (and being completely unusable to any potential other users of the qcow2 format[1]) and only interpreting it somewhere up the stack is a hack.

It's not a hack!
Seriously it's not.
There's nothing wrong with it being aimed higher up the stack than qemu,

Not really, but storing that information in a disk image file is, from my perspective. So far, qcow2 was always just for qemu. (Hmm... Maybe backing links weren't, but at least they were intended for qemu originally.)

Quoted 5 lines
Quoted 2 lines

So this would mix information for different layers inside qcow2 which to me sounds weird. Maybe I just have to get used to it.

The important point is it's explicitly for a different layer; we're not mixing it - the guest can never get to this information.

Neither can it get to bitmaps, but bitmaps are still for qemu.

Quoted 3 lines

It also saves
the higher level management layers ever having to look at the data the guest can get to, which is a security advantage.

Er, well, yes, but guessing configuration options from the guest disk contents is definitely a bad idea, I agree on that anyway.

Quoted 2 lines

From my point of view, it really is the sticky label on the disc rather than the contents of it.

Sure, which is why I wouldn't put it in qcow2. Content and meta-content is what qcow2 currently stores, but not how to use it.

Quoted 9 lines
Quoted 9 lines
Quoted 2 lines

the problem we started off with was what happens when a user downloads a VM image and tries to import it into their VM system;

Well, the VM system should choke without a config file. O:-)

Quoted 3 lines

weve already
got 2+ layers of management stuff in there - I want the information to guide those layers, not form a complete set of configuration.

Quoted 5 lines
Quoted 3 lines

But I do.

If we store some information, I don't see why we don't store all of it.

Hmm, now that generally I don't like:

Me neither.

Quoted 1 line

a) That really would make it hypervisor specific

Yes.

Quoted 1 line

b) It would be a lot of data

Yes.

Quoted 2 lines

c) Generally, the supplier of an image doesn't know how the end-user wants it configured - although for some appliances they might.

Well, yes. But just storing very basic information limits the use case to a very basic case anyway, doesn't it? So this wouldn't be worse.

Everything beyond a very basic use case can expect the user to take 30 seconds to download and pass a config file.

Quoted 3 lines

d) Remember the only problem we had when we got here was how to stop the user shooting themselves in the foot by connecting the wrong image to the wrong VM type.

Hm. How exactly is that shooting yourself in the foot? Won't it just not work?

Quoted 2 lines

So I'm expecting to use this to
contain requirements, nothing more.

Quoted 8 lines

I assumed you'd want to relieve users of having to specify config options in basic use cases. This is why I believed it would be natural to expand that scope.

So why is it so dangerous to connect a disk you just downloaded to e.g. the wrong machine type? I assumed it just wouldn't work and you'd try again, until you realized that maybe you should read the download description and do as it says ("download this config file, pass it").

That's bad! Stuff should just-work; it currently just works, things should get better and easier for our users. And anyway, not working for EFI for exmaple can be just a blank screen. Seriously - keep it easy for the user!

And with 'pc' type VMs being all that's around it does just-work.

Quoted 85 lines
Quoted 18 lines
Quoted 18 lines
Quoted 5 lines
Quoted 5 lines

That is not necessarily a negative point, hacks can work wonderfully well, and they usually are simple, that is correct. But the thing is that I feel like people have grand visions of what to get out of this. Imagine, a single file that can configure all and any VM!

Quoted 8 lines
Quoted 5 lines

But hacks usually only solve a single issue. Once you try to extend a hack, it breaks down and becomes insufficient.

If we want a grand vision where a single file stores the whole VM, why not invest the work and make it right from the start?

Because we won't get it right; however much we bikeshed about it we'll just end up with a mess.

Sure, but the same thing applies to putting it into qcow2. The difference is, for something outside of qcow2, throwing it away and starting over is simple.

Quoted 7 lines
Quoted 2 lines

When putting it into qcow2, we can only do that if we really just put a binary blob there that isn't described in the specification.

Well, it's why I'm going for defined key/values that are stored in the blob and only a few of them. We've got a reasonable chance of being able to define what we want from 3-4 key/values, it should be a lot easier than trying to define a grand scheme.

Yes, as long as we can agree on how we can justify to future generations why we really only want these very few very specific values.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

The right thing is to put in something
to hold configuration and then review the items of configuration we add properly as we define them.

OK, but review them on what terms? Whether they are simple enough?

Well, I'll take simple, make sense - whatever - feel free to be the maintainer for that list!

OK, none. :-P

It would need to be a very strict requirement, in any case. Just "simple" or "dense" do not suffice, because those can be stretched.

Quoted 7 lines
Quoted 2 lines

As I said, I would want a whole configuration if we allow some configuration.

Well then you could go for libvirt XML as the contents; but I think that's crossing layers even more.
(I would have veered more to it being exactly the same as an OVA description except for rjones dislike of it)

Well, the format doesn't really matter for now, I think it's most important to first talk about what kind of scope we want.

Quoted 18 lines
Quoted 9 lines

(More below)

Quoted 6 lines
Quoted 3 lines

[1] Yes, I concede that there are probably no other users of qcow2. But please forgive me for assuming that qcow2 was in a sense designed to be a rather general image format that not only qemu could use.

What makes it QEMU specific? It's basically just the same key/value setup as OVA, except putting them inside the qcow2.

Quoted 8 lines

Well, not necessarily qemu-specific, but ${management_software}-specific, which comes down to the same. Or, well, I'd think that, but hold on.

Quoted 2 lines

We could use the same keys/value definitions as OVA in the blob, although their definitions aren't very portable either.

So you're proposing that we only add options that seem portable for any VM?

Quoted 8 lines

Hmm. We should probably split them, so there should be general options (e.g. minimum-ram) but also hypervisor specifics (qemu.machine-class=q35); but that doesn't mean you can't add keys for multiple hypervisors into the one blob. I mean something like:
minimum-ram = 1G
qemu.machine-class = q35
anothervm.machine-class = ....

Well, and that's my issue. Once you have application-specific info, you can go wild. And I would go wild, without a reasonable and strict requirement that the information we want to store has to fulfill.

Quoted 5 lines

For the record, I would've liked it if you'd said "only portable options". But I would have replied that I would fear we'd still end up with someone saying "I'd like to store X and Y, let's just put them into the specification, then they are portable [even if only this stack supports them]" and we wouldn't really have won anything.

I couldn't second guess every other hypervisor on the planet to know whether specifying a machine class would work for them.

Dave

Quoted 2 lines

Max

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#70 lore raw
In reply to Daniel P. Berrangé
Quoted 10 lines · * Daniel P. Berrangé ([email protected]) wrote:
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 5 lines

Not in this case because it'd still be a flat qcow2 file in a simple tar archive.

But you're right if we had a more complex format (like chunks stored in a tar file).

My only problem with using the tar like that is that all tools everywhere would need to be updated to be able to parse them.

Quoted 7 lines

I feel it is the opposite actually. By adding named blobs or custom strings to qcow2, we've effectively invented a new type of archive format, except apps cant use the normal unzip/tar tools/apis they already have. Instead they need to use qemu-img to read,add,remove blobs from qcow2. It is very compelling to use an existing archive format like tar/zip because every language has APIs for dealing with them and apps probably already do this for things like OVA.

My thinking was that a qcow2 with this extra data would still work in all our existing systems.

Dave

Quoted 6 lines

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 :|

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#152 lore raw
In reply to Max Reitz
Quoted 2 lines · Max Reitz

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

Because why not? It's cheap to add it there and is much easier than teaching people about a new container format.

Eric Blake put it very well I think. There are several things that several people would like to see addressed:

(1) A sensible list of guest visible aspects of the VM preserving which across VM restarts we deem critical enough to support starting guests.
At this point this includes at least architecture and machine type.

(2) A compact file format for serializing list (1)

(3) Ability to store file (2) in a qcow2 image

You are asking why store (2) in qcow2 image specifically. The answer is it's just one place where we can store it. The answer is we don't need to involve qemu-block at all for storing it in other places.

But for many people it will be handy to have it in the same file, and qcow2 is popular enough that many people will be well served if it's there.

Signature · 1 line
MT
#135 lore raw
In reply to Max Reitz
Quoted 4 lines · Max Reitz

Because it's a hack, right. Storing binary data in a qcow2 file, completely ignoring it in qemu (and being completely unusable to any potential other users of the qcow2 format[1]) and only interpreting it somewhere up the stack is a hack.

It's just a first step and it ensures compatibility with old QEMU versions. But down the road I think we will start warning user if the machine type does not match, and possibly even get the type from there if user didn't supply it.

Signature · 1 line
MST
#71 lore raw
In reply to Dr. David Alan Gilbert
Quoted 19 lines · Dr. David Alan Gilbert
Quoted 6 lines · * Max Reitz ([email protected]) wrote:
Quoted 5 lines · Dr. David Alan Gilbert
Quoted 4 lines · * Max Reitz ([email protected]) wrote:
Quoted 3 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Max Reitz ([email protected]) wrote:
Quoted 1 line · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

<snip>

Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The problem with having a separate file is that you either have to copy it around with the image

Which is just an inconvenience.

It's more than that; if it's a separate file then the tools can't rely on users supplying it, and frankly they won't and they'll still just supply an image.

Quoted 5 lines
Quoted 1 line

At which point you throw an error and tell them to specify the config file.

No:
a) At the moment they get away with it for images since they're all 'pc' and the management layers do the right thing.

So so far nobody has complained? I don't really see the problem then.

If deploying a disk and using all the defaults works out for users, great. If they want more options, apparently they already know they have to provide some config.

Quoted 3 lines

b) They'll give the wrong config file - then you'd need to add a flag to detect that - which means you'd need to add something to the qcow to match it to the config; loop back to teh start!

I'm not sure how seriously I should take this argument. Do stupid things, win stupid prizes.

If that's the issue, add a UUID to qcow2 files and reference it from the config file.

Quoted 1 line

We should make this EASY for users.

To me, having a simple config file they can edit manually certainly seems simpler than having to use specific tools to edit it inside of the qcow2 file.

Quoted 31 lines
Quoted 31 lines
Quoted 19 lines
Quoted 3 lines

I understand it is an inconvenience and it would be nice to change it, but please understand that I do not want qcow2 to become a filesystem just to relieve an inconvenience.

I very much don't want it to be a filesystem; my reason for writing down my spec the way I did was to make it clear that the only thing I want of qcow2 is a single blob, no more; I don't want naming of the blob or anything else.

Quoted 2 lines

(Note: I understand that you may not want qcow2 to become a filesystem, but I do get the impression from others.)

My aim was to specify it to fulfill the requirements that everyone else had asked for, but still only having one unmodifiable blob in qcow.

Quoted 4 lines
Quoted 3 lines

or have an archive. If you have an archive
you have to have an unpacking step which then copies, potentially a lot of data taking some reasonable amount of time.

Quoted 8 lines
Quoted 5 lines

I'm sure this can be optimized, but yes, I get that.

(If you use e.g. tar and store the image data starting on an FS cluster boundary (64 kB should be more than sufficient), I assume there is a way to extract that data into a new file without copying anything.)

But then we have to modify all the current things that know how to handle a qcow2.

Not in this case because it'd still be a flat qcow2 file in a simple tar archive.

Quoted 7 lines
Quoted 2 lines

But you're right if we had a more complex format (like chunks stored in a tar file).

My only problem with using the tar like that is that all tools everywhere would need to be updated to be able to parse them. (Note if adding a blob to qcow2 like I'm asking for would break existing qcow2 users then I don't want it either).

OK, so I suppose this goes back to "let's decide what we really want to configure first, and how we can limit our scope in an effective and long-lasting way".

Quoted 25 lines
Quoted 25 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Storing a simple bit
of data with the image avoids that.

It is not a simple bit of data, as evidenced by the discussion about storing binary blobs and MIME types going on.

All of the things they've suggested can be done inside that one blob; even inside the json (or any other structure in that blob).

Right, from qcow2's perspective it's a blob of data. But you can put a whole filesystem into a blob of data, and I get the impression that this is what some are trying to do.

Once we store larger amounts of binary data in that blob (which is what I'm fearing from comments on MIME types and PNG images), people will realize that always having to re-store the whole blob if you modify something in the middle is inefficient and that it needs to be optimized. I don't think you want to do that, but we haven't implemented any of this yet and people are already asking for such binary data inside of the blob.

I suspect it'll only get worse over time.
I think the most difficult thing about this discussion is that there are different targets.

Quoted 6 lines
Quoted 2 lines

You just want to store a bit of information. OK, good, but then I'd say we could even just prepend that to the image file in a small header.

I think you're over-reading what people are asking for.
I think the PNG suggestion is again the 'label on the front' for a logo.

Which is OK if you store like everything, but very much over the top for your suggestion. Again, different people want different things and I feel like that is the real discussion we should be having right now and not necessarily where to store it.

Because I think (maybe I'm wrong, though) where to store it heavily depends on what we want to store and how we want to use it.

Quoted 2 lines

I've not seen anything that's not for either:
a) The user to know what the image is

I thought the use case was they just downloaded it.

Otherwise, they should manage their filenames reasonably, come on. Seriously, adding a cute picture because users are too stupid to manage their VMs is *not* qcow2's problem.

Quoted 1 line

b) The management layer to know what type of VM to create

Apparently this is really what you want. I really still don't see the difficulty in supplying a config file (or the danger in not doing so, or in supplying the wrong one), but, hey, it would be a nice feature indeed.

(I just don't like the tradeoff in complexity.)

Quoted 13 lines
Quoted 7 lines

(Note that extending that header would not even be too complicated, because you can easily move the qcow2 header somewhere else. Say you move it back by one cluster (e.g. 64 kB), then you just put the cluster that was there originally to the end of the file, which is pretty much trivial. Then you copy that original data there and overwrite it with the image header. Done.)

Quoted 5 lines

Others want to store more binary data. Then this may get inefficient and insufficient. But I'd think at this point it gets really problematic to put the data into the qcow2 file because it really doesn't belong there. (I can't imagine anything that would warrant a MIME type.)

Quoted 7 lines

No, I can't imagine why anyone wants a MIME type either.

Quoted 3 lines

Then I've heard proposals of storing multiple disk images. Yes, you could store multiple disks inside of a single qcow2 file, but it would be basically exactly the same as storing just multiple qcow2 files, so...

No, completely agree.

So, yeah, we need a discussion on what to store first, probably in a new thread, and maybe one that is not about qcow2 specifically.

Quoted 14 lines
Quoted 14 lines

And really, I still believe in my slippery slope argument, which means that even if you just want to innocently store a machine type, we will end up with something vastly more complex in the end.

Finally, it appears to me that you have a simple problem, found one possible solution, and now you just focus on that solution instead of taking a step back and looking at the problem again.

The problem: You want to store a binary blob and a disk image together.

Your solution: qcow2 has refcounting and thus "occupation bits". You can put data into it and it will leave it alone, as long as that area is marked as occupied. Let's put the data into the qcow2 file.

Quoted 7 lines
Quoted 5 lines

OK, let's look at the problem and its constraints again.

Hard constraint: Store a single file.
(I don't think this is a hard constraint, because I haven't been convinced yet that handling more than a single file is so bad.)

See above; I think it is.

I know, but you haven't convinced me yet. :-)

Quoted 2 lines

My other hard contraint is that no tool has to change unless it wants to make use of the new data.

Sure that it isn't a soft constraint? If most tools can stay unchanged but some very specific ones have to be changed, that seems reasonable to me.

Quoted 4 lines
Quoted 4 lines

Soft constraint: Max doesn't like storing blobs in qcow2.

So one solution is to ignore the soft constraint. OK, valid solution, I give you that. But it doesn't leave me content, probably understandably so.

[...]

Quoted 8 lines
Quoted 4 lines

But really, if you create a VM, you need a configuration. Like if you set up a new computer, you need to know what you want. Usually there is no sticky label, but you just have to know and input it manually. Maybe you have a sheet of paper, which I'd call the configuration file.

Most things are figurable-out by the management tools/defaults or are dependent on the whim of the user - we're only trying to stop the user doing things that wont work.

But what's so bad about an empty screen because the user hasn't read the download description?

Quoted 3 lines

Simpler example; what stops you trying to put the PPC qcow image into your x86 VM system - nothing that I know of. I just want to stop the users shooting themselves in the foot.

They haven't shot themselves in the foot, they've just wasted a bit of their time, which could've been avoided by reading before clicking.

[...]

Quoted 52 lines
Quoted 45 lines
Quoted 33 lines
Quoted 33 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.

Yes, but in the process you've made it completely opaque to qemu, basically, which doesn't really make it better for me. Not that qemu-specific information in qcow2 files would be what I want, but, well.

But it does solve technical issues, I concede that.

Quoted 3 lines

b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.

Quoted 7 lines
Quoted 3 lines

Not really. The string can be rather long, so you probably don't want to store it in the image header, and thus it's just a binary blob from qcow2's perspective, essentially.

Yes, but it's a single blob - I'm not asking for multiple keyed blobs or the ability to update individual blobs; just one blob that I can replace.

OK, you aren't, but others seem to be.

Or, well, you call it a single blob. But actually the current ideas seem to be to store a rather large configuration tree with binary data in that blob, so to me personally there is absolutely no functional difference to just storing a tar file in that blob.

Quoted 8 lines
Quoted 3 lines

So correct me if I'm wrong, but to me it appears that you effectively want to store a filesystem in qcow2.[1] Well, that's better than making qcow2 the filesystem, but it still appears just the wrong way around to me.

It's different in the sense that what we end up with is still a qcow2; anything that just handles qcow2's and can pass them through doesn't need to do anything different; users don't need to do anything different. No one has to pack/unpack the file.

Packing/unpacking is a strawman because I'm doing my best to give proposals that completely avoid that.

Quoted 6 lines

Users do need to do something different, because users do need to realize that today there is no way to store VM configuration and disk data in a single file. So if they already start VMs just based on a disk, then they are assuming behavior we do not have and that I'd call naive. But that is a strawman from my side, sorry. Keeping naive users happy is probably OK.

Quoted 3 lines

Remember this all works fine now and has done for many years; it's the addition of q35 that breaks that assumption.
The users can already blidly pick up the qcow2 image and stuff it in

Which probably was blind luck already. And if it wasn't, that means they knew the defaults are what they want. So now they'd know they aren't and they have to offer a config file along with the disk image.

Quoted 1 line

and it all works; all I want is for that to keep working.

And all I say is that it's not unreasonable to expect users to realize that a VM is more than a disk image, just like a computer is more than a disk drive; and that handling two files really is not the end of the world.

(And neither is wasting someone's time because they can't read.)

Firstly, I agree it's a nice thing to have, but it's not worth it if we don't come up with clear rules on how to prevent developing a full appliance format.

Or maybe we want that (because I still believe that you can always come up with obscure options without which the VM won't boot in your specific case), but then this is beyond just storing a tiny bit of data in a qcow2 image.

[...]

Quoted 36 lines
Quoted 36 lines
Quoted 35 lines
Quoted 23 lines

[1] Yes, I know that the guest disk already contains an FS. :-P

Quoted 21 lines
Quoted 20 lines
Quoted 11 lines

(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024

I still don't understand why you'd want to put the configuration into qcow2 instead of the other way around.

Or why you'd want to use a single file at all, because as this whole thread shows, a disk image alone is clearly not sufficient to describe a VM.

(Or it may be in simple cases, but then that's because you don't need any configuration.)

Quoted 8 lines
Quoted 1 line

Because it avoids the unpacking associated with archives.

I'm not talking about unpacking. I'm talking about a potentially new format which allows accessing the qcow2 file in-place. It would probably be trivial to write a block driver to allow this.

(And as I wrote in my response to Michal, I suspect that tar could actually allow this, even though it would probably not be the ideal format.)

As above, I don't think this is trivial; you have to change all the layers; lets say it was a tar; you'd have to somehow know that you're importing one of these special tars,

Quoted 5 lines
Quoted 2 lines

Which is trivial because it's just "Hey, look, it's a tar with that description file".

Trivial? It's taking 100+ mails to add a tag to a qcow2 file! Can you imagine what it takes to change libvirt, openstack, ovirt and the rest?

:-)

The implementation is trivial is what I meant, just like the implementation would be rather simple for qcow2 to store a binary blob and completely ignore it.

Quoted 15 lines
Quoted 15 lines
Quoted 2 lines

you also have to have a tool to
create them;

Also trivial. Non-trivial is modifying them.

The workflow would be to create the tar with an empty qcow2 file, the VM description you want, and then just using it.

Yes, using is more difficult, but it wouldn't be an own tool, it would be built into qemu. I can't say how difficult that implementation would be, but it would not be trivial, that is correct.

Quoted 2 lines

and you have to worry about whether that alignment
is correct for the storage/memory you're using it with.

Quoted 7 lines
Quoted 4 lines

Which would be difficult with tar, right. But we don't have to use tar.

(And, no, I don't think creating a new container format is not worse for interoperability than adding a blob to qcow2.)

If you were going to do this then you'd end up just using OVA. You couldn't justify yet another format.

Sure, the exact format doesn't matter to me (or at least currently I don't think it does...). I'm more interested in scope and what good it actually brings.

Max

#125 lore raw
In reply to Dr. David Alan Gilbert
Quoted 1 line · Dr. David Alan Gilbert

* Max Reitz ([email protected]) wrote:

[...]

Quoted 6 lines
Quoted 4 lines

So why is it so dangerous to connect a disk you just downloaded to e.g. the wrong machine type? I assumed it just wouldn't work and you'd try again, until you realized that maybe you should read the download description and do as it says ("download this config file, pass it").

That's bad! Stuff should just-work;

That's how it always should be. Life's tough, though.

Quoted 1 line

it currently just works,

Due to sheer blind luck, I'd say.

Quoted 2 lines

things
should get better and easier for our users.

Users using a whole VM stack plus management, but then handling two files instead of one is too much to ask?

Quoted 3 lines

And anyway, not working for
EFI for exmaple can be just a blank screen. Seriously - keep it easy for the user!

Thinking this through makes you end up with appliances.

Quoted 2 lines

And with 'pc' type VMs being all that's around it does just-work.

[...]

Quoted 29 lines
Quoted 29 lines
Quoted 16 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

[1] Yes, I concede that there are probably no other users of qcow2. But please forgive me for assuming that qcow2 was in a sense designed to be a rather general image format that not only qemu could use.

What makes it QEMU specific? It's basically just the same key/value setup as OVA, except putting them inside the qcow2.

Quoted 8 lines

Well, not necessarily qemu-specific, but ${management_software}-specific, which comes down to the same. Or, well, I'd think that, but hold on.

Quoted 2 lines

We could use the same keys/value definitions as OVA in the blob, although their definitions aren't very portable either.

So you're proposing that we only add options that seem portable for any VM?

Quoted 8 lines

Hmm. We should probably split them, so there should be general options (e.g. minimum-ram) but also hypervisor specifics (qemu.machine-class=q35); but that doesn't mean you can't add keys for multiple hypervisors into the one blob. I mean something like:
minimum-ram = 1G
qemu.machine-class = q35
anothervm.machine-class = ....

Well, and that's my issue. Once you have application-specific info, you can go wild. And I would go wild, without a reasonable and strict requirement that the information we want to store has to fulfill.

Quoted 8 lines
Quoted 5 lines

For the record, I would've liked it if you'd said "only portable options". But I would have replied that I would fear we'd still end up with someone saying "I'd like to store X and Y, let's just put them into the specification, then they are portable [even if only this stack supports them]" and we wouldn't really have won anything.

I couldn't second guess every other hypervisor on the planet to know whether specifying a machine class would work for them.

If they support the config format...

Max

#132 lore raw
In reply to Eduardo Habkost
Quoted 6 lines · Eduardo Habkost
Quoted 2 lines

If we want a grand vision where a single file stores the whole VM, why not invest the work and make it right from the start?

We don't want a grand vision where a single file stores the whole VM. This is exactly what I would like to avoid, by not inventing a whole different appliance file format.

Besides, trying to get a grand vision from the start is a sure way to never have the design leave the drawing board.

What we are asking for at this point is a way to stick a named blob in an image that people can use with qemu without jumping through hoops.

It seems like a generic enough addition that it seems highly likely to be useful down the road and harmless enough that maintaining it won't become a burden.

Can we agree on that as a first step, so we can build that foundation and move on to actually building ways to use it?

Signature · 1 line
MST
#133 lore raw
Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines · Eduardo Habkost
Quoted 2 lines

If we want a grand vision where a single file stores the whole VM, why not invest the work and make it right from the start?

We don't want a grand vision where a single file stores the whole VM. This is exactly what I would like to avoid, by not inventing a whole different appliance file format.

Besides, trying to get a grand vision from the start is a sure way to never have the design leave the drawing board.

Yes, but with our own non-qcow2 format we could easily start with something simple and start over later.

Quoted 6 lines

What we are asking for at this point is a way to stick a named blob in an image that people can use with qemu without jumping through hoops.

It seems like a generic enough addition that it seems highly likely to be useful down the road and harmless enough that maintaining it won't become a burden.

Yes. Its genericity is a big part of what's bothering me.

Quoted 2 lines

Can we agree on that as a first step, so we can build that foundation and move on to actually building ways to use it?

No, because I don't want to agree on putting anything inside qcow2 before I know its scope.

Max

#153 lore raw
In reply to Michael S. Tsirkin
Quoted 6 lines · Michael S. Tsirkin
Quoted 2 lines · Max Reitz

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

Because why not? It's cheap to add it there and is much easier than teaching people about a new container format.

tar is not a new container format, but it is a new format to various toolchains - that said, if we popularize tar as the format for including a config file alongside a qcow2 image, it's not that hard to fix the stack to start passing that file around as the new preferred file type.

Quoted 8 lines

Eric Blake put it very well I think. There are several things that several people would like to see addressed:

(1) A sensible list of guest visible aspects of the VM preserving which across VM restarts we deem critical enough to support starting guests.
At this point this includes at least architecture and machine type.

This part is true no matter where we store it. So as I see it, the question is now whether to store it in qcow2, or whether to store qcow2 + config in a tar file.

Quoted 2 lines

(2) A compact file format for serializing list (1)

tar files already serve this purpose (even if we don't like the current OVA specification for the config side, it at least proves that tar files are usable in this manner)

Quoted 2 lines

(3) Ability to store file (2) in a qcow2 image

As Dan pointed out, if we can FIRST popularize storing a config file + qcow2 in a tar file, THEN we can (for convenience) let qcow2 directly store the same config file, if it helps things (although if popularizing tar files works, we wouldn't need it in qcow2).

Maybe the step we want to take now is to add a new block driver to qemu that supports tar files including resize. That is, where we currently do:

qcow2 -> posix file

we would instead popularize:

qcow2 -> tar driver -> posix file

where the tar driver takes care of finding the right subset within the overall tar file, AND makes it easy to resize (by updating tar metadata any time qcow2 wants to resize larger, and assuming qcow2 is the last member of the tar archive)

Perhaps we can even automate it so that the tar driver is automatically inserted even when not explicitly specified (after all, you can already start qemu by giving just the file name holding a qcow2 image, and qemu can figure out to use the qcow2 driver) - although we DO have to be careful of avoiding CVEs (probing image formats MUST NOT allow a guest to convert a raw image into something that qemu would treat as a tar, any more than it would misinterpret raw as qcow2)

Quoted 5 lines

You are asking why store (2) in qcow2 image specifically. The answer is it's just one place where we can store it. The answer is we don't need to involve qemu-block at all for storing it in other places.

Then why start with qcow2? Let's start with tar files, and enhance qemu-block to make tar files containing qcow2 easier to use in qemu (and NOT with making qcow2 larger just to bypass tar files).

Quoted 5 lines

But for many people it will be handy to have it in the same file, and qcow2 is popular enough that many people will be well served if it's there.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#156 lore raw
In reply to Michael S. Tsirkin
Quoted 6 lines · Michael S. Tsirkin
Quoted 2 lines · Max Reitz

Yeah, but why make qcow2 that format? That's what I completely fail to understand.

Because why not? It's cheap to add it there and is much easier than teaching people about a new container format.

"new" container format? qcow2 is not a container format, so that would be teaching people something new anyway.

Quoted 7 lines

Eric Blake put it very well I think. There are several things that several people would like to see addressed:

(1) A sensible list of guest visible aspects of the VM preserving which across VM restarts we deem critical enough to support starting guests.
At this point this includes at least architecture and machine type.

If you use a whole management layer, that is trivial anyway (and that seems to be Dave's assumption), because that management layer can store its configuration somewhere. Dave's issue was about downloading foreign images, not about restarts.

Quoted 1 line

(2) A compact file format for serializing list (1)

OK.

Quoted 1 line

(3) Ability to store file (2) in a qcow2 image

I see that people are asking this, yes, although I don't quite get the point.

Quoted 7 lines

You are asking why store (2) in qcow2 image specifically. The answer is it's just one place where we can store it. The answer is we don't need to involve qemu-block at all for storing it in other places.

But for many people it will be handy to have it in the same file, and qcow2 is popular enough that many people will be well served if it's there.

Note that I'm also asking why it needs to be a single file. Furthermore, I'm asking what the final scope is intended to be. I don't believe qcow2 to be the correct format for a whole appliance, but I do believe that assuming that people want to provide just a qcow2 file without anything else means already accepting it *is* an appliance. But Dave seems to reject that idea.

Max

#136 lore raw
In reply to Michael S. Tsirkin
Quoted 10 lines · Michael S. Tsirkin
Quoted 4 lines · Max Reitz

Because it's a hack, right. Storing binary data in a qcow2 file, completely ignoring it in qemu (and being completely unusable to any potential other users of the qcow2 format[1]) and only interpreting it somewhere up the stack is a hack.

It's just a first step and it ensures compatibility with old QEMU versions. But down the road I think we will start warning user if the machine type does not match, and possibly even get the type from there if user didn't supply it.

If it's a first step we should have an idea on what the following steps should be.

I don't want people to convince me that adding a blob to qcow2 is a good idea because "we are only going to store two or three values!" and then that blob grows out of control because "well, now we have it anyway".

Max

#72 lore raw
In reply to Max Reitz
Quoted 26 lines · * Max Reitz ([email protected]) wrote:
Quoted 19 lines · Dr. David Alan Gilbert
Quoted 6 lines · * Max Reitz ([email protected]) wrote:
Quoted 5 lines · Dr. David Alan Gilbert
Quoted 4 lines · * Max Reitz ([email protected]) wrote:
Quoted 3 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Max Reitz ([email protected]) wrote:
Quoted 1 line · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

<snip>

Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The problem with having a separate file is that you either have to copy it around with the image

Which is just an inconvenience.

It's more than that; if it's a separate file then the tools can't rely on users supplying it, and frankly they won't and they'll still just supply an image.

Quoted 5 lines
Quoted 1 line

At which point you throw an error and tell them to specify the config file.

No:
a) At the moment they get away with it for images since they're all 'pc' and the management layers do the right thing.

Quoted 5 lines

So so far nobody has complained? I don't really see the problem then.

If deploying a disk and using all the defaults works out for users, great. If they want more options, apparently they already know they have to provide some config.

This problem all came about because of q35. We can't change defaults to use q35 because importing existing images might break so we need to start flagging stuff as q35 - all we're trying to do is make stuff no more broken than today.

Quoted 9 lines
Quoted 3 lines

b) They'll give the wrong config file - then you'd need to add a flag to detect that - which means you'd need to add something to the qcow to match it to the config; loop back to teh start!

I'm not sure how seriously I should take this argument. Do stupid things, win stupid prizes.

If that's the issue, add a UUID to qcow2 files and reference it from the config file.

Is a UUID a small string :-)

Quoted 5 lines
Quoted 1 line

We should make this EASY for users.

To me, having a simple config file they can edit manually certainly seems simpler than having to use specific tools to edit it inside of the qcow2 file.

The users never touch the tools; they click and import the VM image.

Quoted 80 lines
Quoted 31 lines
Quoted 31 lines
Quoted 19 lines
Quoted 3 lines

I understand it is an inconvenience and it would be nice to change it, but please understand that I do not want qcow2 to become a filesystem just to relieve an inconvenience.

I very much don't want it to be a filesystem; my reason for writing down my spec the way I did was to make it clear that the only thing I want of qcow2 is a single blob, no more; I don't want naming of the blob or anything else.

Quoted 2 lines

(Note: I understand that you may not want qcow2 to become a filesystem, but I do get the impression from others.)

My aim was to specify it to fulfill the requirements that everyone else had asked for, but still only having one unmodifiable blob in qcow.

Quoted 4 lines
Quoted 3 lines

or have an archive. If you have an archive
you have to have an unpacking step which then copies, potentially a lot of data taking some reasonable amount of time.

Quoted 8 lines
Quoted 5 lines

I'm sure this can be optimized, but yes, I get that.

(If you use e.g. tar and store the image data starting on an FS cluster boundary (64 kB should be more than sufficient), I assume there is a way to extract that data into a new file without copying anything.)

But then we have to modify all the current things that know how to handle a qcow2.

Not in this case because it'd still be a flat qcow2 file in a simple tar archive.

Quoted 7 lines
Quoted 2 lines

But you're right if we had a more complex format (like chunks stored in a tar file).

My only problem with using the tar like that is that all tools everywhere would need to be updated to be able to parse them. (Note if adding a blob to qcow2 like I'm asking for would break existing qcow2 users then I don't want it either).

OK, so I suppose this goes back to "let's decide what we really want to configure first, and how we can limit our scope in an effective and long-lasting way".

Quoted 25 lines
Quoted 25 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Storing a simple bit
of data with the image avoids that.

It is not a simple bit of data, as evidenced by the discussion about storing binary blobs and MIME types going on.

All of the things they've suggested can be done inside that one blob; even inside the json (or any other structure in that blob).

Right, from qcow2's perspective it's a blob of data. But you can put a whole filesystem into a blob of data, and I get the impression that this is what some are trying to do.

Once we store larger amounts of binary data in that blob (which is what I'm fearing from comments on MIME types and PNG images), people will realize that always having to re-store the whole blob if you modify something in the middle is inefficient and that it needs to be optimized. I don't think you want to do that, but we haven't implemented any of this yet and people are already asking for such binary data inside of the blob.

I suspect it'll only get worse over time.
I think the most difficult thing about this discussion is that there are different targets.

Quoted 6 lines
Quoted 2 lines

You just want to store a bit of information. OK, good, but then I'd say we could even just prepend that to the image file in a small header.

I think you're over-reading what people are asking for.
I think the PNG suggestion is again the 'label on the front' for a logo.

Which is OK if you store like everything, but very much over the top for your suggestion. Again, different people want different things and I feel like that is the real discussion we should be having right now and not necessarily where to store it.

Quoted 7 lines

Because I think (maybe I'm wrong, though) where to store it heavily depends on what we want to store and how we want to use it.

Quoted 2 lines

I've not seen anything that's not for either:
a) The user to know what the image is

I thought the use case was they just downloaded it.

Or pulled it from that big directory of images.

Quoted 3 lines

Otherwise, they should manage their filenames reasonably, come on. Seriously, adding a cute picture because users are too stupid to manage their VMs is *not* qcow2's problem.

Well, it's someones problem; we already have magic to display those images in some of the higher level tools.

Quoted 7 lines
Quoted 1 line

b) The management layer to know what type of VM to create

Apparently this is really what you want. I really still don't see the difficulty in supplying a config file (or the danger in not doing so, or in supplying the wrong one), but, hey, it would be a nice feature indeed.

(I just don't like the tradeoff in complexity.)

Remember, give this to someone who doesn't understand what the difference is between the machine types etc.

Quoted 46 lines
Quoted 13 lines
Quoted 7 lines

(Note that extending that header would not even be too complicated, because you can easily move the qcow2 header somewhere else. Say you move it back by one cluster (e.g. 64 kB), then you just put the cluster that was there originally to the end of the file, which is pretty much trivial. Then you copy that original data there and overwrite it with the image header. Done.)

Quoted 5 lines

Others want to store more binary data. Then this may get inefficient and insufficient. But I'd think at this point it gets really problematic to put the data into the qcow2 file because it really doesn't belong there. (I can't imagine anything that would warrant a MIME type.)

Quoted 7 lines

No, I can't imagine why anyone wants a MIME type either.

Quoted 3 lines

Then I've heard proposals of storing multiple disk images. Yes, you could store multiple disks inside of a single qcow2 file, but it would be basically exactly the same as storing just multiple qcow2 files, so...

No, completely agree.

So, yeah, we need a discussion on what to store first, probably in a new thread, and maybe one that is not about qcow2 specifically.

Quoted 14 lines
Quoted 14 lines

And really, I still believe in my slippery slope argument, which means that even if you just want to innocently store a machine type, we will end up with something vastly more complex in the end.

Finally, it appears to me that you have a simple problem, found one possible solution, and now you just focus on that solution instead of taking a step back and looking at the problem again.

The problem: You want to store a binary blob and a disk image together.

Your solution: qcow2 has refcounting and thus "occupation bits". You can put data into it and it will leave it alone, as long as that area is marked as occupied. Let's put the data into the qcow2 file.

Quoted 7 lines
Quoted 5 lines

OK, let's look at the problem and its constraints again.

Hard constraint: Store a single file.
(I don't think this is a hard constraint, because I haven't been convinced yet that handling more than a single file is so bad.)

See above; I think it is.

Quoted 7 lines

I know, but you haven't convinced me yet. :-)

Quoted 2 lines

My other hard contraint is that no tool has to change unless it wants to make use of the new data.

Sure that it isn't a soft constraint? If most tools can stay unchanged but some very specific ones have to be changed, that seems reasonable to me.

The hard constraint is the normal path stays unchanged; we can change the tools to make use of the extra data, but not change what's out there.

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines

Soft constraint: Max doesn't like storing blobs in qcow2.

So one solution is to ignore the soft constraint. OK, valid solution, I give you that. But it doesn't leave me content, probably understandably so.

[...]

Quoted 5 lines
Quoted 4 lines

But really, if you create a VM, you need a configuration. Like if you set up a new computer, you need to know what you want. Usually there is no sticky label, but you just have to know and input it manually. Maybe you have a sheet of paper, which I'd call the configuration file.

Quoted 6 lines
Quoted 3 lines

Most things are figurable-out by the management tools/defaults or are dependent on the whim of the user - we're only trying to stop the user doing things that wont work.

But what's so bad about an empty screen because the user hasn't read the download description?

Because it's got to be EASY for the customer; seriously - stop punishing the user for not noticing something.
We've got to help the users, if not we get people asking why their VM system has given them a black screen, or why the image they just downloaded didn't work - it's basic user friendliness.

It's not obvious why it's failed; if it was as simple as a nice box popping up telling them they'd booted it wouldn't be too bad; but some of them will waste 3 hours trying to figure out wth happened.

*seriously* think about our users.

Quoted 6 lines
Quoted 3 lines

Simpler example; what stops you trying to put the PPC qcow image into your x86 VM system - nothing that I know of. I just want to stop the users shooting themselves in the foot.

They haven't shot themselves in the foot, they've just wasted a bit of their time, which could've been avoided by reading before clicking.

*seriously* think about our users.

Quoted 54 lines

[...]

Quoted 52 lines
Quoted 51 lines
Quoted 33 lines
Quoted 33 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.

Yes, but in the process you've made it completely opaque to qemu, basically, which doesn't really make it better for me. Not that qemu-specific information in qcow2 files would be what I want, but, well.

But it does solve technical issues, I concede that.

Quoted 3 lines

b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.

Quoted 7 lines
Quoted 3 lines

Not really. The string can be rather long, so you probably don't want to store it in the image header, and thus it's just a binary blob from qcow2's perspective, essentially.

Yes, but it's a single blob - I'm not asking for multiple keyed blobs or the ability to update individual blobs; just one blob that I can replace.

OK, you aren't, but others seem to be.

Or, well, you call it a single blob. But actually the current ideas seem to be to store a rather large configuration tree with binary data in that blob, so to me personally there is absolutely no functional difference to just storing a tar file in that blob.

Quoted 8 lines
Quoted 3 lines

So correct me if I'm wrong, but to me it appears that you effectively want to store a filesystem in qcow2.[1] Well, that's better than making qcow2 the filesystem, but it still appears just the wrong way around to me.

It's different in the sense that what we end up with is still a qcow2; anything that just handles qcow2's and can pass them through doesn't need to do anything different; users don't need to do anything different. No one has to pack/unpack the file.

Packing/unpacking is a strawman because I'm doing my best to give proposals that completely avoid that.

Users do need to do something different, because users do need to realize that today there is no way to store VM configuration and disk data in a single file. So if they already start VMs just based on a disk, then they are assuming behavior we do not have and that I'd call naive. But that is a strawman from my side, sorry. Keeping naive users happy is probably OK.

Quoted 7 lines
Quoted 3 lines

Remember this all works fine now and has done for many years; it's the addition of q35 that breaks that assumption.
The users can already blidly pick up the qcow2 image and stuff it in

Which probably was blind luck already. And if it wasn't, that means they knew the defaults are what they want. So now they'd know they aren't and they have to offer a config file along with the disk image.

No, it's not blind look; it's that the management tools know how to get it right.

Quoted 7 lines
Quoted 1 line

and it all works; all I want is for that to keep working.

And all I say is that it's not unreasonable to expect users to realize that a VM is more than a disk image, just like a computer is more than a disk drive; and that handling two files really is not the end of the world.

(And neither is wasting someone's time because they can't read.)

*seriously* think about our users.

Quoted 8 lines

Firstly, I agree it's a nice thing to have, but it's not worth it if we don't come up with clear rules on how to prevent developing a full appliance format.

Or maybe we want that (because I still believe that you can always come up with obscure options without which the VM won't boot in your specific case), but then this is beyond just storing a tiny bit of data in a qcow2 image.

I don't want to protect them from really trying to shoot themselves in the foot; I just want to make sure the easy-path works. Download an image, tell the tool to import; VM works. All good.

Quoted 41 lines

[...]

Quoted 39 lines
Quoted 38 lines
Quoted 29 lines
Quoted 29 lines

[1] Yes, I know that the guest disk already contains an FS. :-P

Quoted 15 lines
Quoted 15 lines
Quoted 11 lines

(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024

I still don't understand why you'd want to put the configuration into qcow2 instead of the other way around.

Quoted 7 lines
Quoted 5 lines

Or why you'd want to use a single file at all, because as this whole thread shows, a disk image alone is clearly not sufficient to describe a VM.

(Or it may be in simple cases, but then that's because you don't need any configuration.)

Because it avoids the unpacking associated with archives.

I'm not talking about unpacking. I'm talking about a potentially new format which allows accessing the qcow2 file in-place. It would probably be trivial to write a block driver to allow this.

Quoted 6 lines
Quoted 2 lines

(And as I wrote in my response to Michal, I suspect that tar could actually allow this, even though it would probably not be the ideal format.)

As above, I don't think this is trivial; you have to change all the layers; lets say it was a tar; you'd have to somehow know that you're importing one of these special tars,

Which is trivial because it's just "Hey, look, it's a tar with that description file".

Quoted 8 lines
Quoted 2 lines

Trivial? It's taking 100+ mails to add a tag to a qcow2 file! Can you imagine what it takes to change libvirt, openstack, ovirt and the rest?

:-)

The implementation is trivial is what I meant, just like the implementation would be rather simple for qcow2 to store a binary blob and completely ignore it.

But then you'd have people shipping .newformat files as well as qcow2 files and you'd have to persuade people to start doing that, and they'd ship both or none or....

Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
Quoted 2 lines

you also have to have a tool to
create them;

Also trivial. Non-trivial is modifying them.

The workflow would be to create the tar with an empty qcow2 file, the VM description you want, and then just using it.

Yes, using is more difficult, but it wouldn't be an own tool, it would be built into qemu. I can't say how difficult that implementation would be, but it would not be trivial, that is correct.

Quoted 2 lines

and you have to worry about whether that alignment
is correct for the storage/memory you're using it with.

Which would be difficult with tar, right. But we don't have to use tar.

(And, no, I don't think creating a new container format is not worse for interoperability than adding a blob to qcow2.)

Quoted 6 lines
Quoted 2 lines

If you were going to do this then you'd end up just using OVA. You couldn't justify yet another format.

Sure, the exact format doesn't matter to me (or at least currently I don't think it does...). I'm more interested in scope and what good it actually brings.

Dave

Quoted 2 lines

Max

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#101 lore raw
In reply to Max Reitz
Quoted 26 lines · Max Reitz
Quoted 19 lines · Dr. David Alan Gilbert
Quoted 6 lines · * Max Reitz ([email protected]) wrote:
Quoted 5 lines · Dr. David Alan Gilbert
Quoted 4 lines · * Max Reitz ([email protected]) wrote:
Quoted 3 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Max Reitz ([email protected]) wrote:
Quoted 1 line · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

<snip>

Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The problem with having a separate file is that you either have to copy it around with the image

Which is just an inconvenience.

It's more than that; if it's a separate file then the tools can't rely on users supplying it, and frankly they won't and they'll still just supply an image.

Quoted 5 lines
Quoted 1 line

At which point you throw an error and tell them to specify the config file.

No:
a) At the moment they get away with it for images since they're all 'pc' and the management layers do the right thing.

Quoted 5 lines

So so far nobody has complained? I don't really see the problem then.

If deploying a disk and using all the defaults works out for users, great. If they want more options, apparently they already know they have to provide some config.

QEMU's usability is terrible. There are tons of tools out there to try to tame it, but of course they lack the knowledge of the VM internals that QEMU has.

Quoted 7 lines
Quoted 3 lines

b) They'll give the wrong config file - then you'd need to add a flag to detect that - which means you'd need to add something to the qcow to match it to the config; loop back to teh start!

I'm not sure how seriously I should take this argument. Do stupid things, win stupid prizes.

Quoted 8 lines

If that's the issue, add a UUID to qcow2 files and reference it from the config file.

Quoted 1 line

We should make this EASY for users.

To me, having a simple config file they can edit manually certainly seems simpler than having to use specific tools to edit it inside of the qcow2 file.

I think you are one of the happy users familiar with qemu intricacies and/or using a tool on top that does it for you.

Quoted 75 lines
Quoted 31 lines
Quoted 31 lines
Quoted 19 lines
Quoted 3 lines

I understand it is an inconvenience and it would be nice to change it, but please understand that I do not want qcow2 to become a filesystem just to relieve an inconvenience.

I very much don't want it to be a filesystem; my reason for writing down my spec the way I did was to make it clear that the only thing I want of qcow2 is a single blob, no more; I don't want naming of the blob or anything else.

Quoted 2 lines

(Note: I understand that you may not want qcow2 to become a filesystem, but I do get the impression from others.)

My aim was to specify it to fulfill the requirements that everyone else had asked for, but still only having one unmodifiable blob in qcow.

Quoted 4 lines
Quoted 3 lines

or have an archive. If you have an archive
you have to have an unpacking step which then copies, potentially a lot of data taking some reasonable amount of time.

Quoted 8 lines
Quoted 5 lines

I'm sure this can be optimized, but yes, I get that.

(If you use e.g. tar and store the image data starting on an FS cluster boundary (64 kB should be more than sufficient), I assume there is a way to extract that data into a new file without copying anything.)

But then we have to modify all the current things that know how to handle a qcow2.

Not in this case because it'd still be a flat qcow2 file in a simple tar archive.

Quoted 7 lines
Quoted 2 lines

But you're right if we had a more complex format (like chunks stored in a tar file).

My only problem with using the tar like that is that all tools everywhere would need to be updated to be able to parse them. (Note if adding a blob to qcow2 like I'm asking for would break existing qcow2 users then I don't want it either).

OK, so I suppose this goes back to "let's decide what we really want to configure first, and how we can limit our scope in an effective and long-lasting way".

Quoted 25 lines
Quoted 25 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Storing a simple bit
of data with the image avoids that.

It is not a simple bit of data, as evidenced by the discussion about storing binary blobs and MIME types going on.

All of the things they've suggested can be done inside that one blob; even inside the json (or any other structure in that blob).

Right, from qcow2's perspective it's a blob of data. But you can put a whole filesystem into a blob of data, and I get the impression that this is what some are trying to do.

Once we store larger amounts of binary data in that blob (which is what I'm fearing from comments on MIME types and PNG images), people will realize that always having to re-store the whole blob if you modify something in the middle is inefficient and that it needs to be optimized. I don't think you want to do that, but we haven't implemented any of this yet and people are already asking for such binary data inside of the blob.

I suspect it'll only get worse over time.
I think the most difficult thing about this discussion is that there are different targets.

Quoted 6 lines
Quoted 2 lines

You just want to store a bit of information. OK, good, but then I'd say we could even just prepend that to the image file in a small header.

I think you're over-reading what people are asking for.
I think the PNG suggestion is again the 'label on the front' for a logo.

Quoted 7 lines

Which is OK if you store like everything, but very much over the top for your suggestion. Again, different people want different things and I feel like that is the real discussion we should be having right now and not necessarily where to store it.

Because I think (maybe I'm wrong, though) where to store it heavily depends on what we want to store and how we want to use it.

I don't really see why.

Quoted 8 lines
Quoted 2 lines

I've not seen anything that's not for either:
a) The user to know what the image is

I thought the use case was they just downloaded it.

Otherwise, they should manage their filenames reasonably, come on. Seriously, adding a cute picture because users are too stupid to manage their VMs is *not* qcow2's problem.

QEMU is hard to use right and it is QEMU's problem. Users aren't stupid but neither do they have the time to learn internals of the tools they use.

Quoted 74 lines
Quoted 1 line

b) The management layer to know what type of VM to create

Apparently this is really what you want. I really still don't see the difficulty in supplying a config file (or the danger in not doing so, or in supplying the wrong one), but, hey, it would be a nice feature indeed.

(I just don't like the tradeoff in complexity.)

Quoted 13 lines
Quoted 7 lines

(Note that extending that header would not even be too complicated, because you can easily move the qcow2 header somewhere else. Say you move it back by one cluster (e.g. 64 kB), then you just put the cluster that was there originally to the end of the file, which is pretty much trivial. Then you copy that original data there and overwrite it with the image header. Done.)

Quoted 5 lines

Others want to store more binary data. Then this may get inefficient and insufficient. But I'd think at this point it gets really problematic to put the data into the qcow2 file because it really doesn't belong there. (I can't imagine anything that would warrant a MIME type.)

Quoted 7 lines

No, I can't imagine why anyone wants a MIME type either.

Quoted 3 lines

Then I've heard proposals of storing multiple disk images. Yes, you could store multiple disks inside of a single qcow2 file, but it would be basically exactly the same as storing just multiple qcow2 files, so...

No, completely agree.

So, yeah, we need a discussion on what to store first, probably in a new thread, and maybe one that is not about qcow2 specifically.

Quoted 14 lines
Quoted 14 lines

And really, I still believe in my slippery slope argument, which means that even if you just want to innocently store a machine type, we will end up with something vastly more complex in the end.

Finally, it appears to me that you have a simple problem, found one possible solution, and now you just focus on that solution instead of taking a step back and looking at the problem again.

The problem: You want to store a binary blob and a disk image together.

Your solution: qcow2 has refcounting and thus "occupation bits". You can put data into it and it will leave it alone, as long as that area is marked as occupied. Let's put the data into the qcow2 file.

Quoted 7 lines
Quoted 5 lines

OK, let's look at the problem and its constraints again.

Hard constraint: Store a single file.
(I don't think this is a hard constraint, because I haven't been convinced yet that handling more than a single file is so bad.)

See above; I think it is.

I know, but you haven't convinced me yet. :-)

Quoted 2 lines

My other hard contraint is that no tool has to change unless it wants to make use of the new data.

Sure that it isn't a soft constraint? If most tools can stay unchanged but some very specific ones have to be changed, that seems reasonable to me.

Quoted 4 lines
Quoted 4 lines

Soft constraint: Max doesn't like storing blobs in qcow2.

So one solution is to ignore the soft constraint. OK, valid solution, I give you that. But it doesn't leave me content, probably understandably so.

[...]

Quoted 5 lines
Quoted 4 lines

But really, if you create a VM, you need a configuration. Like if you set up a new computer, you need to know what you want. Usually there is no sticky label, but you just have to know and input it manually. Maybe you have a sheet of paper, which I'd call the configuration file.

Quoted 6 lines
Quoted 3 lines

Most things are figurable-out by the management tools/defaults or are dependent on the whim of the user - we're only trying to stop the user doing things that wont work.

But what's so bad about an empty screen because the user hasn't read the download description?

Because user just learns to avoid QEMU as being too hard in the future.

Quoted 8 lines
Quoted 3 lines

Simpler example; what stops you trying to put the PPC qcow image into your x86 VM system - nothing that I know of. I just want to stop the users shooting themselves in the foot.

They haven't shot themselves in the foot, they've just wasted a bit of their time, which could've been avoided by reading before clicking.

[...]

Software developers are being paid for saving people's time.

Quoted 72 lines
Quoted 52 lines
Quoted 45 lines
Quoted 33 lines
Quoted 33 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.

Yes, but in the process you've made it completely opaque to qemu, basically, which doesn't really make it better for me. Not that qemu-specific information in qcow2 files would be what I want, but, well.

But it does solve technical issues, I concede that.

Quoted 3 lines

b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.

Quoted 7 lines
Quoted 3 lines

Not really. The string can be rather long, so you probably don't want to store it in the image header, and thus it's just a binary blob from qcow2's perspective, essentially.

Yes, but it's a single blob - I'm not asking for multiple keyed blobs or the ability to update individual blobs; just one blob that I can replace.

OK, you aren't, but others seem to be.

Or, well, you call it a single blob. But actually the current ideas seem to be to store a rather large configuration tree with binary data in that blob, so to me personally there is absolutely no functional difference to just storing a tar file in that blob.

Quoted 8 lines
Quoted 3 lines

So correct me if I'm wrong, but to me it appears that you effectively want to store a filesystem in qcow2.[1] Well, that's better than making qcow2 the filesystem, but it still appears just the wrong way around to me.

It's different in the sense that what we end up with is still a qcow2; anything that just handles qcow2's and can pass them through doesn't need to do anything different; users don't need to do anything different. No one has to pack/unpack the file.

Packing/unpacking is a strawman because I'm doing my best to give proposals that completely avoid that.

Quoted 6 lines

Users do need to do something different, because users do need to realize that today there is no way to store VM configuration and disk data in a single file. So if they already start VMs just based on a disk, then they are assuming behavior we do not have and that I'd call naive. But that is a strawman from my side, sorry. Keeping naive users happy is probably OK.

Quoted 3 lines

Remember this all works fine now and has done for many years; it's the addition of q35 that breaks that assumption.
The users can already blidly pick up the qcow2 image and stuff it in

Which probably was blind luck already. And if it wasn't, that means they knew the defaults are what they want. So now they'd know they aren't and they have to offer a config file along with the disk image.

Quoted 1 line

and it all works; all I want is for that to keep working.

And all I say is that it's not unreasonable to expect users to realize that a VM is more than a disk image, just like a computer is more than a disk drive; and that handling two files really is not the end of the world.

(And neither is wasting someone's time because they can't read.)

Firstly, I agree it's a nice thing to have, but it's not worth it if we don't come up with clear rules on how to prevent developing a full appliance format.

Quoted 6 lines

Or maybe we want that (because I still believe that you can always come up with obscure options without which the VM won't boot in your specific case), but then this is beyond just storing a tiny bit of data in a qcow2 image.

[...]

Either we'll add more and more data later or we won't. Why worry about it from the start? We'll never get anywhere if we do.

Quoted 39 lines
Quoted 39 lines
Quoted 38 lines
Quoted 29 lines
Quoted 29 lines

[1] Yes, I know that the guest disk already contains an FS. :-P

Quoted 15 lines
Quoted 15 lines
Quoted 11 lines

(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024

I still don't understand why you'd want to put the configuration into qcow2 instead of the other way around.

Quoted 7 lines
Quoted 5 lines

Or why you'd want to use a single file at all, because as this whole thread shows, a disk image alone is clearly not sufficient to describe a VM.

(Or it may be in simple cases, but then that's because you don't need any configuration.)

Because it avoids the unpacking associated with archives.

I'm not talking about unpacking. I'm talking about a potentially new format which allows accessing the qcow2 file in-place. It would probably be trivial to write a block driver to allow this.

Quoted 6 lines
Quoted 2 lines

(And as I wrote in my response to Michal, I suspect that tar could actually allow this, even though it would probably not be the ideal format.)

As above, I don't think this is trivial; you have to change all the layers; lets say it was a tar; you'd have to somehow know that you're importing one of these special tars,

Which is trivial because it's just "Hey, look, it's a tar with that description file".

Quoted 8 lines
Quoted 2 lines

Trivial? It's taking 100+ mails to add a tag to a qcow2 file! Can you imagine what it takes to change libvirt, openstack, ovirt and the rest?

:-)

The implementation is trivial is what I meant, just like the implementation would be rather simple for qcow2 to store a binary blob and completely ignore it.

Old QEMU can't handle tar files. You need to unpack them, then figure out that there are two files in the tar, one is just for new qemu versions, one is portable. At which point you need to go figure out what is your QEMU version.

Quoted 29 lines
Quoted 15 lines
Quoted 15 lines
Quoted 2 lines

you also have to have a tool to
create them;

Also trivial. Non-trivial is modifying them.

The workflow would be to create the tar with an empty qcow2 file, the VM description you want, and then just using it.

Yes, using is more difficult, but it wouldn't be an own tool, it would be built into qemu. I can't say how difficult that implementation would be, but it would not be trivial, that is correct.

Quoted 2 lines

and you have to worry about whether that alignment
is correct for the storage/memory you're using it with.

Quoted 7 lines
Quoted 4 lines

Which would be difficult with tar, right. But we don't have to use tar.

(And, no, I don't think creating a new container format is not worse for interoperability than adding a blob to qcow2.)

If you were going to do this then you'd end up just using OVA. You couldn't justify yet another format.

Sure, the exact format doesn't matter to me (or at least currently I don't think it does...). I'm more interested in scope and what good it actually brings.

Max

#126 lore raw
In reply to Max Reitz
Quoted 11 lines · On Wed, 6 Jun 2018 16:55:08 +0200 Max Reitz <[email protected]> wrote:
Quoted 1 line · Dr. David Alan Gilbert

* Max Reitz ([email protected]) wrote:

[...]

Quoted 6 lines
Quoted 5 lines

So why is it so dangerous to connect a disk you just downloaded to e.g. the wrong machine type? I assumed it just wouldn't work and you'd try again, until you realized that maybe you should read the download description and do as it says ("download this config file, pass it").

Quoted 7 lines
Quoted 1 line

That's bad! Stuff should just-work;

That's how it always should be. Life's tough, though.

Quoted 1 line

it currently just works,

Due to sheer blind luck, I'd say.

It's TimeProvenSolution(tm).

Quoted 6 lines
Quoted 3 lines

things
should get better and easier for our users.

Users using a whole VM stack plus management, but then handling two files instead of one is too much to ask?

What you don't seem to realize is there are cases when there is an 'administrator' who has set up the VM stack plus management and 'joe user' who wants to run some random VM on that stack.

And if you download an appliance compatible with the stack it should just work. For a long time the 'appliance' for qemu based virtualization was a simple qcow2 file which was sized sufficiently for the VM to run but shrunk for transport. And although it is technically wrong it JustWorked(tm).

Quoted 6 lines
Quoted 4 lines

And anyway, not
working for EFI for exmaple can be just a blank screen. Seriously
- keep it easy for the user!

Thinking this through makes you end up with appliances.

And those can in general have more than one disk.

Thanks

Michal

#73 lore raw
In reply to Dr. David Alan Gilbert
Quoted 4 lines · Dr. David Alan Gilbert
Quoted 2 lines

If that's the issue, add a UUID to qcow2 files and reference it from the config file.

Is a UUID a small string :-)

Even better, it's something that you could stick directly in the qcow2 header (and which therefore cannot grow to a larger size) - it would be a well-constrained scoped addition. Maybe the analogy to actual hardware would be that the config file is like a sticky note, and a UUID embedded in the qcow2 file would be the disk serial number; if you are paranoid that the sticky note could be too easily pulled off one disk and put on another, then the sticky note can include the serial number.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

We should make this EASY for users.

To me, having a simple config file they can edit manually certainly seems simpler than having to use specific tools to edit it inside of the qcow2 file.

The users never touch the tools; they click and import the VM image.

And if we make it easy to import a tar file as the VM image, then that's still the case.

Quoted 6 lines
Quoted 2 lines

Sure that it isn't a soft constraint? If most tools can stay unchanged but some very specific ones have to be changed, that seems reasonable to me.

The hard constraint is the normal path stays unchanged; we can change the tools to make use of the extra data, but not change what's out there.

But for the new config to be useful, you have to modify at least one tool in the path. At which point, it is just as easy to say: "libvirt is now smart enough to read the config file out of a .qcow2 to know that it should prefer a q35 machine" as it is to say "libvirt is now smart enough to treat a .tar file containing .qcow2 and a config file that states that it should prefer a q35 machine", and either approach requires just a single file for the user to download. Or, if you are worried about what happens in a too-old system that doesn't understand the config file, you have either: "the tool didn't know that the .qcow2 contained a config snippet, and tried to open the qcow2 file with pc even though q35 would have been better" or "the tool didn't know that the .tar file contains a config snippet and .qcow2 image, and could not run the image". Either way, the image with the new config data doesn't run unless the user realizes they need to upgrade their system - but trying (and failing) to run is actually less friendly than flat out claiming unrecognized format and failing early. So going with the tar format actually encourages users to upgrade, unlike going with enhancing qcow2.

Quoted 7 lines

Because it's got to be EASY for the customer; seriously - stop punishing the user for not noticing something.
We've got to help the users, if not we get people asking why their VM system has given them a black screen, or why the image they just downloaded didn't work - it's basic user friendliness.

Quoted 5 lines

It's not obvious why it's failed; if it was as simple as a nice box popping up telling them they'd booted it wouldn't be too bad; but some of them will waste 3 hours trying to figure out wth happened.

*seriously* think about our users.

I am - to me, telling a user that "here is your image, it is a new file extension, therefore you need a new qemu before you can even try to use it - but once you have that, everything just works" is nicer than "here is the same extension you've always used, but it might not work for you and it might be 3 hours of your time to figure out why it didn't work".

Quoted 8 lines
Quoted 4 lines

The implementation is trivial is what I meant, just like the implementation would be rather simple for qcow2 to store a binary blob and completely ignore it.

But then you'd have people shipping .newformat files as well as qcow2 files and you'd have to persuade people to start doing that, and they'd ship both or none or....

Why would you intentionally ship a .qcow2 that only works on q35 if .newformat is already known to be nicer to users? Just ship .newformat!
People shipping just .qcow2 would be limited to those used to 'pc' as
the default, but even they could be encouraged to tweak their process to make it easier for end consumers to take advantage of .newformat.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#147 lore raw
In reply to Max Reitz
Quoted 124 lines · Max Reitz
Quoted 38 lines · Michal Suchánek
Quoted 35 lines · On Wed, 6 Jun 2018 15:14:03 +0200 Max Reitz <[email protected]> wrote:
Quoted 10 lines · Michal Suchánek
Quoted 7 lines · On Wed, 6 Jun 2018 13:52:35 +0200 Max Reitz <[email protected]> wrote:
Quoted 6 lines · Michal Suchánek
Quoted 3 lines · On Wed, 6 Jun 2018 13:32:47 +0200 Max Reitz <[email protected]> wrote:
Quoted 2 lines · Michal Suchánek

On Wed, 6 Jun 2018 13:02:53 +0200
Max Reitz <[email protected]> wrote:

[...]

Quoted 20 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

What I'm trying to get at is that qcow2 was not designed to be a container format for arbitrary files. If you want to make it such, I'm sure there are existing formats that work better.

Such as?

ext2?

Quoted 7 lines
Quoted 2 lines

So you want an ext2 driver in qemu instead of expanding qcow2 to work not only for a single disk but also for an appliance?

Yes, because ext2 was designed to be a proper filesystem. I'm not an FS designer. Well, not a good one anyway. So I don't trust myself on extending qcow2 to be a good FS -- and why would I, when there are already numerous FS around.

Do you expect that performance of qemu using qcow2 driver over ext2 driver will be better than using qcow driver directly with some part semi-permanently occupied by a configuration blob? My bet is not.

Quoted 6 lines
Quoted 3 lines

If you want to store multiple disk images in a single file? I would think so, yes. With qcow2, I would assume it leads to fragmentation.

How is that different from single disk divided into two partitions internally (without any knowledge on the qcow2 level)?

From how it's going to be fragmented, there is no difference. If you have multiple partitions and write to them concurrently, thus allocating new areas, you get bad fragmentation.

Quoted 3 lines
Quoted 1 line

I would hope that proper filesystems can mitigate this.

Not really. Not without much complexity and repeated maintenance.

Yes, a proper filesystem. Which we'd get for free with multiple files.

Quoted 11 lines
Quoted 9 lines
Quoted 6 lines

The ext* drivers are designed to work with kernel VM infrastructure which must be tuned for different usage scenarios and you would have to duplicate that tuning in qemu to get competitive performance. Also you get qcow2 and ext2 metadata which must be allocated, managed, etc. You get more storage and performance overhead for no good reason.

Yes, there is a good reason. You can add arbitrary configuration options without having to worry about me.

But I will not be able to use the images in qemu so it will be useless.

Neither can you with the current proposal because that is about adding management layer configuration options which are opaque to qemu.

Quoted 2 lines

Well, there is FUSE and that is certainly blazing fast and ubiquitous, I am sure.

If you want to use pre-existing drivers, you'd probably use a loop device.

Otherwise, you'd use the block layer for accessing the disk.

If you want blazingly fast, you probably won't use qcow2 anyway. Or, funnily enough, you'd want to probably split the qcow2 file into a metadata and a data file, so you get even more files. (But that is a proposal for the future.)

Quoted 30 lines
Quoted 30 lines

Seriously, though, a real FS would allow you to be more expressive and really do what you want without having to work around the quirks that adding a not-real-FS in the most simple way possible to qcow2 would bring with it.

Because this is part of my fear, that we now add a very simple blob for just a sprinkle of data. But over time it gets more and more complex because we want to store more and more data to make things ever more convenient[1], we notice that we need more features, the format gets more complex, and in the end we have an FS that is just worse than a real FS.

[1] And note that if I'm convinced to store VM configuration data in qemu, I will agree that we can store any data in there and it would be nice if any VM could be provisioned and used that way.

Quoted 4 lines

On the other hand, qcow is designed for storing VM disk data and hopefully was tuned to do that decently over the years. The primary use case remains storing VM disk data. Adding a configuration blob does not change that.

True. So the argument is that qcow2 may be worse for storing arbitrary data, but we don't have performance requirements for that; but we do have performance requirements for disk data and adding another format below qcow2 will not make it better.

I do think it is possible to not make things worse with a format under qcow2, but that may require additional complexity, that you think is pointless.

Quoted 7 lines
Quoted 3 lines

I understand that you think that, but I still believe that putting the configuration into qcow2 is just the wrong way around and will fall on our feet in the long run.

I think that *if* we want an 'appliance' format that stores a whole VM in a single file to ease VM distribution then the logical place to look in qemu is qcow. The reason have been explained at length.

The reason being that it's the easiest place, yes. That doesn't make it the best place.

Quoted 8 lines
Quoted 2 lines

I understand that for some use cases simplifying the distribution of VMs as much as possible is quite important.

I don't because still nobody has explained it to me.

The only explanation I got so far was "People are lazy and we have defaults for everything, so we don't throw an error if people forget to pass a configuration file."

People don't pass a configuration file today because there's no standard for such a configuration file. qcow2 is already used today as an appliance file format because there's no better option. People download disk images from appliance and OS providers, import them into a cloud system, and it works out of the box because (luckily) "pc" is enough for most of them.

We can specify a true appliance file format, and ask people to use it. But then providers of single-disk appliances and OSes will need to publish two appliance images: qcow2 disk image for old systems that don't support the new format, and one in the new appliance format, for systems that support it.

Quoted 2 lines

Which to me still just makes it an inconvenience.

Well, there are small inconveniences and there are big inconveniences that together make a system unnecessarily hard to use. I'd say this one falls somewhere in the middle.

[...]

Quoted 7 lines

I'm noticing a pattern here, and that is that everybody has a different opinion on what we actually want in the end, and it's just by chance that we find ourselves in two camps ("put it in qcow2" vs. "put it somewhere else").

Maybe we should first discuss what we actually want before we can discuss where to put it.

I'm inclined to agree. Once we figure out a good VM description format, we can justify a proposal to allow embedding the VM description in qcow2 for convenience.

Signature · 1 line
Eduardo
#74 lore raw
In reply to Eric Blake
Quoted 33 lines · On Wed, 6 Jun 2018 10:36:20 -0500 Eric Blake <[email protected]> wrote:
Quoted 9 lines · Dr. David Alan Gilbert
Quoted 6 lines
Quoted 2 lines

We should make this EASY for users.

To me, having a simple config file they can edit manually certainly seems simpler than having to use specific tools to edit it inside of the qcow2 file.

The users never touch the tools; they click and import the VM image.

And if we make it easy to import a tar file as the VM image, then that's still the case.

Quoted 7 lines
Quoted 3 lines

Sure that it isn't a soft constraint? If most tools can stay unchanged but some very specific ones have to be changed, that seems reasonable to me.

The hard constraint is the normal path stays unchanged; we can change the tools to make use of the extra data, but not change what's out there.

But for the new config to be useful, you have to modify at least one tool in the path. At which point, it is just as easy to say:
"libvirt is now smart enough to read the config file out of a .qcow2 to know that it should prefer a q35 machine" as it is to say "libvirt is now smart enough to treat a .tar file containing .qcow2 and a config file that states that it should prefer a q35 machine", and either approach requires just a single file for the user to download. Or, if you are worried about what happens in a too-old system that doesn't understand the config file, you have either: "the tool didn't know that the .qcow2 contained a config snippet, and

Quoted 9 lines

tried to open the qcow2 file with pc even though q35 would have been better" or "the tool didn't know that the .tar file contains a config snippet and .qcow2 image, and could not run the image". Either way, the image with the new config data doesn't run unless the user realizes they need to upgrade their system - but trying (and failing) to run is actually less friendly than flat out claiming unrecognized format and failing early. So going with the tar format actually encourages users to upgrade, unlike going with enhancing qcow2.

Yes, that's a good argument.

The reason why storing the config inside the qcow2 file is you have one self-contained file that can be updated by qemu itself.

So you take an image file, point your management console to it, boot it, change something on it, shut it down, and publish the image as the new revision of the VM.

With the tar file the management console needs to chew the tar file, save a copy of the config file and the disk image somewhere, and when you update the image you have to re-export the tar file.

This is a lot of lengthy copying. The upside is that the console can check that the machine you are exporting is not running an you are not prone to publishing images in inconsistent state.

Thanks

Michal

#76 lore raw
In reply to Eric Blake
Quoted 34 lines · Eric Blake
Quoted 4 lines · Dr. David Alan Gilbert
Quoted 2 lines

If that's the issue, add a UUID to qcow2 files and reference it from the config file.

Is a UUID a small string :-)

Even better, it's something that you could stick directly in the qcow2 header (and which therefore cannot grow to a larger size) - it would be a well-constrained scoped addition. Maybe the analogy to actual hardware would be that the config file is like a sticky note, and a UUID embedded in the qcow2 file would be the disk serial number; if you are paranoid that the sticky note could be too easily pulled off one disk and put on another, then the sticky note can include the serial number.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

We should make this EASY for users.

To me, having a simple config file they can edit manually certainly seems simpler than having to use specific tools to edit it inside of the qcow2 file.

The users never touch the tools; they click and import the VM image.

And if we make it easy to import a tar file as the VM image, then that's still the case.

Quoted 6 lines
Quoted 2 lines

Sure that it isn't a soft constraint? If most tools can stay unchanged but some very specific ones have to be changed, that seems reasonable to me.

The hard constraint is the normal path stays unchanged; we can change the tools to make use of the extra data, but not change what's out there.

Quoted 7 lines

But for the new config to be useful, you have to modify at least one tool in the path. At which point, it is just as easy to say: "libvirt is now smart enough to read the config file out of a .qcow2 to know that it should prefer a q35 machine" as it is to say "libvirt is now smart enough to treat a .tar file containing .qcow2 and a config file that states that it should prefer a q35 machine", and either approach requires just a single file for the user to download.

Just to be clear, libvirt isn't going to do either of those things.

Whether there is metadata stuffed inside qcow2, or in a metdata file inside a tar file, libvirt is not going to look inside either of them. The XML is the only place libvirt deals with the hardware config.

Extracting machine type is always going to be a job for the layer above such as OpenStack/OVirt/Virt-manager/etc. They will then decide whether or not they want to honour that info, and if so, put it into the XML they give to libvirt.

As mentioned elsewhere, IMHO, it is more friendly to those tools to use pre-existing formats, eg TAR and XML/JSON, for which their respective programming langauges already have APIs/parsers.

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 :|
#77 lore raw
Quoted 49 lines · * Daniel P. Berrangé ([email protected]) wrote:
Quoted 34 lines · Eric Blake
Quoted 4 lines · Dr. David Alan Gilbert
Quoted 2 lines

If that's the issue, add a UUID to qcow2 files and reference it from the config file.

Is a UUID a small string :-)

Even better, it's something that you could stick directly in the qcow2 header (and which therefore cannot grow to a larger size) - it would be a well-constrained scoped addition. Maybe the analogy to actual hardware would be that the config file is like a sticky note, and a UUID embedded in the qcow2 file would be the disk serial number; if you are paranoid that the sticky note could be too easily pulled off one disk and put on another, then the sticky note can include the serial number.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

We should make this EASY for users.

To me, having a simple config file they can edit manually certainly seems simpler than having to use specific tools to edit it inside of the qcow2 file.

The users never touch the tools; they click and import the VM image.

And if we make it easy to import a tar file as the VM image, then that's still the case.

Quoted 6 lines
Quoted 2 lines

Sure that it isn't a soft constraint? If most tools can stay unchanged but some very specific ones have to be changed, that seems reasonable to me.

The hard constraint is the normal path stays unchanged; we can change the tools to make use of the extra data, but not change what's out there.

Quoted 7 lines

But for the new config to be useful, you have to modify at least one tool in the path. At which point, it is just as easy to say: "libvirt is now smart enough to read the config file out of a .qcow2 to know that it should prefer a q35 machine" as it is to say "libvirt is now smart enough to treat a .tar file containing .qcow2 and a config file that states that it should prefer a q35 machine", and either approach requires just a single file for the user to download.

Just to be clear, libvirt isn't going to do either of those things.

Whether there is metadata stuffed inside qcow2, or in a metdata file inside a tar file, libvirt is not going to look inside either of them. The XML is the only place libvirt deals with the hardware config.

Quoted 8 lines

Extracting machine type is always going to be a job for the layer above such as OpenStack/OVirt/Virt-manager/etc. They will then decide whether or not they want to honour that info, and if so, put it into the XML they give to libvirt.

As mentioned elsewhere, IMHO, it is more friendly to those tools to use pre-existing formats, eg TAR and XML/JSON, for which their respective programming langauges already have APIs/parsers.

Libvirt could provide a wrapper around whichever format to extract the data and provide it to the upper layer. It could also validate against it to see if the constraints were met as a service for an upper layer.

Dave

Quoted 7 lines

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 :|

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#75 lore raw
In reply to Michal Suchánek
Quoted 10 lines · Michal Suchánek

The reason why storing the config inside the qcow2 file is you have one self-contained file that can be updated by qemu itself.

So you take an image file, point your management console to it, boot it, change something on it, shut it down, and publish the image as the new revision of the VM.

With the tar file the management console needs to chew the tar file, save a copy of the config file and the disk image somewhere, and when you update the image you have to re-export the tar file.

That's not necessarily true. We're arguing that as long as the qcow2 image is last in the tar file, it should still be relatively easy to write a qemu block driver that manages tar files for in-place qcow2 editing. GNU tar can also do --append or --update to modify the config file; although we may have to be careful if that starts to make the qcow2 image not the last member in the tar file. On the other hand, if updating the config file is a common enough operation, I would not be surprised if we end up teaching the qemu tar driver how to resize images even when the qcow2 portion of the tar file is not last, or adding qemu-img commands that wrap typical tar file manipulations.

Quoted 4 lines

This is a lot of lengthy copying. The upside is that the console can check that the machine you are exporting is not running an you are not prone to publishing images in inconsistent state.

Read-only qcow2 within a tar does NOT require lengthy copying. Updating qcow2 within tar might, but then again, we are arguing that with a sane layout, copying the ENTIRE qcow2 portion is NOT always going to be necessary. For example, modern Linux has things like fallocate(FALLOC_FL_INSERT_RANGE) (on file systems that are capable) for enlarging the head of a tar file enough to stick in a larger config file at the front, with a LOT less data movement effort when compared to moving the qcow2 tail of that same tar file.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#102 lore raw
In reply to Michael S. Tsirkin
Quoted 29 lines · Michael S. Tsirkin
Quoted 28 lines · Max Reitz
Quoted 19 lines · Dr. David Alan Gilbert
Quoted 6 lines · * Max Reitz ([email protected]) wrote:
Quoted 5 lines · Dr. David Alan Gilbert
Quoted 4 lines · * Max Reitz ([email protected]) wrote:
Quoted 3 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Max Reitz ([email protected]) wrote:
Quoted 1 line · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

<snip>

Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The problem with having a separate file is that you either have to copy it around with the image

Which is just an inconvenience.

It's more than that; if it's a separate file then the tools can't rely on users supplying it, and frankly they won't and they'll still just supply an image.

Quoted 5 lines
Quoted 1 line

At which point you throw an error and tell them to specify the config file.

No:
a) At the moment they get away with it for images since they're all 'pc' and the management layers do the right thing.

So so far nobody has complained? I don't really see the problem then.

Quoted 7 lines
Quoted 3 lines

If deploying a disk and using all the defaults works out for users, great. If they want more options, apparently they already know they have to provide some config.

QEMU's usability is terrible. There are tons of tools out there to try to tame it, but of course they lack the knowledge of the VM internals that QEMU has.

Er, yeah, OK. But it was my understanding that we decided that we have a management layer on top of qemu to make things simple.

Also, this is once more a case of first deciding what we want at all. Dave wants configuration options for the upper management layer which are completely opaque to qemu. That has nothing to do whatsoever with the usability of qemu itself.

Quoted 10 lines
Quoted 10 lines
Quoted 3 lines

b) They'll give the wrong config file - then you'd need to add a flag to detect that - which means you'd need to add something to the qcow to match it to the config; loop back to teh start!

I'm not sure how seriously I should take this argument. Do stupid things, win stupid prizes.

If that's the issue, add a UUID to qcow2 files and reference it from the config file.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

We should make this EASY for users.

To me, having a simple config file they can edit manually certainly seems simpler than having to use specific tools to edit it inside of the qcow2 file.

I think you are one of the happy users familiar with qemu intricacies and/or using a tool on top that does it for you.

Yeah, virt-manager and sometimes libvirt directly. Works nicely. In any case, having to manage more than a single file was never one of my worries. In fact, I never had to manage any file because both tools do it for me.

And again, I don't know what the usability of qemu has to do with what Dave is proposing.

[...]

Quoted 4 lines
Quoted 2 lines

Because I think (maybe I'm wrong, though) where to store it heavily depends on what we want to store and how we want to use it.

I don't really see why.

For instance, supporting full-blown appliances would mean supporting multiple images. Maybe in multiple formats. Maybe the user wants runtime performance and is willing to give up a bit of installation time for that (e.g. for unpacking an archive).

In any case, if we want to be able to configure every kind of VM, tying everything to qcow2 seems like a bad idea. First defining a format and then deciding on whether it makes sense to be able to put it into qcow2 for certain subcases seems much more reasonable.

And if you make the format decidedly qcow2-independent, the whole "putting it into qcow2 is the simplest implementation" argument becomes rather weak.

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

I've not seen anything that's not for either:
a) The user to know what the image is

I thought the use case was they just downloaded it.

Quoted 7 lines
Quoted 3 lines

Otherwise, they should manage their filenames reasonably, come on. Seriously, adding a cute picture because users are too stupid to manage their VMs is *not* qcow2's problem.

QEMU is hard to use right and it is QEMU's problem. Users aren't stupid but neither do they have the time to learn internals of the tools they use.

Technically, it's the users' problem. It may be qemu's fault, though.

I will not say it is qemu's fault, because I was always told we have a management layer to make things simple again. "qemu worries about execution, management layer worries about policy" is what I was told.

Also, I have no idea what you are talking about. I gave a very specific example. How is adding a picture to a VM disk image going to help anyone? If that's the issue people are facing, I would argue they probably have a multitude of different issues with using qemu, because I fully agree with you on that point -- using qemu for complex cases is hard. Well, no, it's simple, really, but then you probably won't get the best out of it. (As can be seen by the fact that some people seem to start their VM just based on a disk image, and that seems to work...)

So, using qemu in the best way possible is hard. But a pictogram in a disk image will not solve that problem. I was always told that using a management layer solves the problem. And as I understood, this was what Dave's proposal was about, the management layer, not qemu.

I would expect from the management layer to at least make managing VMs easy. The management layer can give names. It can present pictures. It can manage files. It can export a config file + disk image so that it can be imported somewhere else.

Therefore, I don't know what you mean by "learn internals of the tools they use". They don't need to do that, if they use a management layer. All they need to do is to supply everything the management layer may ask of them, and I do not understand why it is too difficult to request a plain config file that the user doesn't even need to understand. They just need to download it along with the disk image.

But all of that writing once again comes down to this: You are talking about qemu. Dave is talking about something higher in the management layer. Those are different things, and as I said, we first need to find common ground there.

This is exactly why I said "where to store it heavily depends on what we want to store and how we want to use it." As long as we don't know that, all of us are using strawman arguments where some other party suddenly chimes in and says "no, no, no, this is not what I'm talking about". Yes, maybe you aren't, but someone else is.

[...]

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

But really, if you create a VM, you need a configuration. Like if you set up a new computer, you need to know what you want. Usually there is no sticky label, but you just have to know and input it manually. Maybe you have a sheet of paper, which I'd call the configuration file.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Most things are figurable-out by the management tools/defaults or are dependent on the whim of the user - we're only trying to stop the user doing things that wont work.

But what's so bad about an empty screen because the user hasn't read the download description?

Because user just learns to avoid QEMU as being too hard in the future.

So you want appliances, do I understand that correctly? Because that is exactly what Dave doesn't want.

Furthermore, another case of "qemu is too hard to use". I will not argue against you there, because that may very well be true, but I will once again say that I was of the impression that we had management layers to handle that complexity.

Quoted 10 lines
Quoted 8 lines
Quoted 3 lines

Simpler example; what stops you trying to put the PPC qcow image into your x86 VM system - nothing that I know of. I just want to stop the users shooting themselves in the foot.

They haven't shot themselves in the foot, they've just wasted a bit of their time, which could've been avoided by reading before clicking.

[...]

Software developers are being paid for saving people's time.

Very good point, but I did say something like this before: I do not oppose appliances whatsoever. In fact, it seems like a nice thing to have.

But, here's the deal: I do not think putting that data into qcow2 to be the best solution. Furthermore, I have things to do that I consider more important than developing an appliance solution. Therefore, it's not like I'm sitting around doing nothing when I could be developing a solution to this issue here.

I kept saying that I consider all of this an inconvenience. Yes, it would be nice to have. But I have things on my to do list that are hard feature requests, things that people really do need. We all have. We all need to decide how we can use our own time as efficiently as possible. And I do not think that developing an appliance solution would be the best use of my time. (Until my manager disagrees.)

Quoted 77 lines
Quoted 77 lines
Quoted 52 lines
Quoted 45 lines
Quoted 33 lines
Quoted 33 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.

Yes, but in the process you've made it completely opaque to qemu, basically, which doesn't really make it better for me. Not that qemu-specific information in qcow2 files would be what I want, but, well.

But it does solve technical issues, I concede that.

Quoted 3 lines

b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.

Quoted 7 lines
Quoted 3 lines

Not really. The string can be rather long, so you probably don't want to store it in the image header, and thus it's just a binary blob from qcow2's perspective, essentially.

Yes, but it's a single blob - I'm not asking for multiple keyed blobs or the ability to update individual blobs; just one blob that I can replace.

OK, you aren't, but others seem to be.

Or, well, you call it a single blob. But actually the current ideas seem to be to store a rather large configuration tree with binary data in that blob, so to me personally there is absolutely no functional difference to just storing a tar file in that blob.

Quoted 8 lines
Quoted 3 lines

So correct me if I'm wrong, but to me it appears that you effectively want to store a filesystem in qcow2.[1] Well, that's better than making qcow2 the filesystem, but it still appears just the wrong way around to me.

It's different in the sense that what we end up with is still a qcow2; anything that just handles qcow2's and can pass them through doesn't need to do anything different; users don't need to do anything different. No one has to pack/unpack the file.

Packing/unpacking is a strawman because I'm doing my best to give proposals that completely avoid that.

Quoted 6 lines

Users do need to do something different, because users do need to realize that today there is no way to store VM configuration and disk data in a single file. So if they already start VMs just based on a disk, then they are assuming behavior we do not have and that I'd call naive. But that is a strawman from my side, sorry. Keeping naive users happy is probably OK.

Quoted 3 lines

Remember this all works fine now and has done for many years; it's the addition of q35 that breaks that assumption.
The users can already blidly pick up the qcow2 image and stuff it in

Which probably was blind luck already. And if it wasn't, that means they knew the defaults are what they want. So now they'd know they aren't and they have to offer a config file along with the disk image.

Quoted 1 line

and it all works; all I want is for that to keep working.

And all I say is that it's not unreasonable to expect users to realize that a VM is more than a disk image, just like a computer is more than a disk drive; and that handling two files really is not the end of the world.

(And neither is wasting someone's time because they can't read.)

Firstly, I agree it's a nice thing to have, but it's not worth it if we don't come up with clear rules on how to prevent developing a full appliance format.

Or maybe we want that (because I still believe that you can always come up with obscure options without which the VM won't boot in your specific case), but then this is beyond just storing a tiny bit of data in a qcow2 image.

Quoted 4 lines
Quoted 1 line

[...]

Either we'll add more and more data later or we won't. Why worry about it from the start? We'll never get anywhere if we do.

That is not a very good argument. Adding things always means having to support them later. It does make a lot of sense to worry about this burden before starting, and thus trying to find the best possible solution for the future, not the easiest hack for now.

And as I've said multiple times now, but I can't repeat myself often enough, I think it would be most efficient if we worried about what we want to store first, before we worry about where to store it. I believe that once we have a hard requirement on what we want to store and how to use it (that most people agree on), we will have a set of constraints on how we can represent that data and where it needs to be stored, and this will give us a simple yes or no to the question whether the data needs to be stored in qcow2, or whether there is any better way (or whether it can be stored in qcow2, but need not be).

Quoted 44 lines
Quoted 44 lines
Quoted 36 lines
Quoted 36 lines
Quoted 35 lines
Quoted 23 lines

[1] Yes, I know that the guest disk already contains an FS. :-P

Quoted 21 lines
Quoted 20 lines
Quoted 11 lines

(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024

I still don't understand why you'd want to put the configuration into qcow2 instead of the other way around.

Or why you'd want to use a single file at all, because as this whole thread shows, a disk image alone is clearly not sufficient to describe a VM.

(Or it may be in simple cases, but then that's because you don't need any configuration.)

Quoted 8 lines
Quoted 1 line

Because it avoids the unpacking associated with archives.

I'm not talking about unpacking. I'm talking about a potentially new format which allows accessing the qcow2 file in-place. It would probably be trivial to write a block driver to allow this.

(And as I wrote in my response to Michal, I suspect that tar could actually allow this, even though it would probably not be the ideal format.)

As above, I don't think this is trivial; you have to change all the layers; lets say it was a tar; you'd have to somehow know that you're importing one of these special tars,

Quoted 5 lines
Quoted 2 lines

Which is trivial because it's just "Hey, look, it's a tar with that description file".

Trivial? It's taking 100+ mails to add a tag to a qcow2 file! Can you imagine what it takes to change libvirt, openstack, ovirt and the rest?

:-)

Quoted 8 lines
Quoted 3 lines

The implementation is trivial is what I meant, just like the implementation would be rather simple for qcow2 to store a binary blob and completely ignore it.

Old QEMU can't handle tar files. You need to unpack them, then figure out that there are two files in the tar, one is just for new qemu versions, one is portable. At which point you need to go figure out what is your QEMU version.

And old qemu versions will just give you a blank screen for a qcow2 file with required non-default options.

Max

#100 lore raw
In reply to Dr. David Alan Gilbert
Quoted 29 lines · Dr. David Alan Gilbert
Quoted 28 lines · * Max Reitz ([email protected]) wrote:
Quoted 19 lines · Dr. David Alan Gilbert
Quoted 6 lines · * Max Reitz ([email protected]) wrote:
Quoted 5 lines · Dr. David Alan Gilbert
Quoted 4 lines · * Max Reitz ([email protected]) wrote:
Quoted 3 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Max Reitz ([email protected]) wrote:
Quoted 1 line · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

<snip>

Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The problem with having a separate file is that you either have to copy it around with the image

Which is just an inconvenience.

It's more than that; if it's a separate file then the tools can't rely on users supplying it, and frankly they won't and they'll still just supply an image.

Quoted 5 lines
Quoted 1 line

At which point you throw an error and tell them to specify the config file.

No:
a) At the moment they get away with it for images since they're all 'pc' and the management layers do the right thing.

So so far nobody has complained? I don't really see the problem then.

Quoted 8 lines
Quoted 3 lines

If deploying a disk and using all the defaults works out for users, great. If they want more options, apparently they already know they have to provide some config.

This problem all came about because of q35. We can't change defaults to use q35 because importing existing images might break so we need to start flagging stuff as q35 - all we're trying to do is make stuff no more broken than today.

Well, I really don't want to go into this much further. I understand that you see it as a bug prevention. But as I've said, we've always had this issue, e.g. with minimum RAM required. It's nothing new.

But the most important thing is that other people seem to really disagree on your "I don't want it to get an appliance" stance.

Quoted 11 lines
Quoted 9 lines
Quoted 3 lines

b) They'll give the wrong config file - then you'd need to add a flag to detect that - which means you'd need to add something to the qcow to match it to the config; loop back to teh start!

I'm not sure how seriously I should take this argument. Do stupid things, win stupid prizes.

If that's the issue, add a UUID to qcow2 files and reference it from the config file.

Is a UUID a small string :-)

Well, it certainly isn't unheard of for disk image formats, so I'm much more inclined to include it.

Though UUIDs tend to be nasty to handle, but as long as they don't change... Oh well.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

We should make this EASY for users.

To me, having a simple config file they can edit manually certainly seems simpler than having to use specific tools to edit it inside of the qcow2 file.

The users never touch the tools; they click and import the VM image.

Not really, no. I know these are the end users, but others (the providers) probably do want to edit the config file.

[...]

Quoted 40 lines
Quoted 40 lines
Quoted 25 lines
Quoted 25 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Storing a simple bit
of data with the image avoids that.

It is not a simple bit of data, as evidenced by the discussion about storing binary blobs and MIME types going on.

All of the things they've suggested can be done inside that one blob; even inside the json (or any other structure in that blob).

Right, from qcow2's perspective it's a blob of data. But you can put a whole filesystem into a blob of data, and I get the impression that this is what some are trying to do.

Once we store larger amounts of binary data in that blob (which is what I'm fearing from comments on MIME types and PNG images), people will realize that always having to re-store the whole blob if you modify something in the middle is inefficient and that it needs to be optimized. I don't think you want to do that, but we haven't implemented any of this yet and people are already asking for such binary data inside of the blob.

I suspect it'll only get worse over time.
I think the most difficult thing about this discussion is that there are different targets.

Quoted 6 lines
Quoted 2 lines

You just want to store a bit of information. OK, good, but then I'd say we could even just prepend that to the image file in a small header.

I think you're over-reading what people are asking for.
I think the PNG suggestion is again the 'label on the front' for a logo.

Which is OK if you store like everything, but very much over the top for your suggestion. Again, different people want different things and I feel like that is the real discussion we should be having right now and not necessarily where to store it.

Because I think (maybe I'm wrong, though) where to store it heavily depends on what we want to store and how we want to use it.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I've not seen anything that's not for either:
a) The user to know what the image is

I thought the use case was they just downloaded it.

Or pulled it from that big directory of images.

I don't know what to say.

Maybe this: I do not believe you can convince me that this is a reasonable use case. Please do not make me fix the problems people get because they cannot identify their own files.

Quoted 6 lines
Quoted 3 lines

Otherwise, they should manage their filenames reasonably, come on. Seriously, adding a cute picture because users are too stupid to manage their VMs is *not* qcow2's problem.

Well, it's someones problem; we already have magic to display those images in some of the higher level tools.

Sure. virt-manager gives me cute pictures for my VMs, and I'm grateful for that. (Actually just cute names, but you know.)

But I absolutely do not see this as a qcow2-level issue. It might be an appliance-level issue, though.

Quoted 10 lines
Quoted 7 lines
Quoted 1 line

b) The management layer to know what type of VM to create

Apparently this is really what you want. I really still don't see the difficulty in supplying a config file (or the danger in not doing so, or in supplying the wrong one), but, hey, it would be a nice feature indeed.

(I just don't like the tradeoff in complexity.)

Remember, give this to someone who doesn't understand what the difference is between the machine types etc.

But you don't tell them "Configure this machine type". There are two download links. One says "Disk image". The other says "VM config file". The description says to download both and to import the VM config file into their management application, which will then proceed to ask for the disk image (automatically, perchance!), and that's it. No understanding required.

[...]

Quoted 27 lines
Quoted 27 lines
Quoted 14 lines
Quoted 14 lines

And really, I still believe in my slippery slope argument, which means that even if you just want to innocently store a machine type, we will end up with something vastly more complex in the end.

Finally, it appears to me that you have a simple problem, found one possible solution, and now you just focus on that solution instead of taking a step back and looking at the problem again.

The problem: You want to store a binary blob and a disk image together.

Your solution: qcow2 has refcounting and thus "occupation bits". You can put data into it and it will leave it alone, as long as that area is marked as occupied. Let's put the data into the qcow2 file.

Quoted 7 lines
Quoted 5 lines

OK, let's look at the problem and its constraints again.

Hard constraint: Store a single file.
(I don't think this is a hard constraint, because I haven't been convinced yet that handling more than a single file is so bad.)

See above; I think it is.

I know, but you haven't convinced me yet. :-)

Quoted 2 lines

My other hard contraint is that no tool has to change unless it wants to make use of the new data.

Quoted 6 lines
Quoted 2 lines

Sure that it isn't a soft constraint? If most tools can stay unchanged but some very specific ones have to be changed, that seems reasonable to me.

The hard constraint is the normal path stays unchanged; we can change the tools to make use of the extra data, but not change what's out there.

Ah, right, because you want the data to be visible in previously legacy VMs, too. I see. Though I'd argue that legacy VMs are already covered by a management application which can store all of that information somewhere else. Managing multiple files is easy for a management application and never visible to the user. Exporting and importing VMs is the point at which it would get visible, but I'd think that is just a temporary state (before the VM is imported into the user's management application, at which point that target application can just create its own configuration file again).

Quoted 16 lines
Quoted 16 lines
Quoted 4 lines
Quoted 4 lines

Soft constraint: Max doesn't like storing blobs in qcow2.

So one solution is to ignore the soft constraint. OK, valid solution, I give you that. But it doesn't leave me content, probably understandably so.

[...]

Quoted 8 lines
Quoted 4 lines

But really, if you create a VM, you need a configuration. Like if you set up a new computer, you need to know what you want. Usually there is no sticky label, but you just have to know and input it manually. Maybe you have a sheet of paper, which I'd call the configuration file.

Most things are figurable-out by the management tools/defaults or are dependent on the whim of the user - we're only trying to stop the user doing things that wont work.

Quoted 8 lines
Quoted 2 lines

But what's so bad about an empty screen because the user hasn't read the download description?

Because it's got to be EASY for the customer; seriously - stop punishing the user for not noticing something.
We've got to help the users, if not we get people asking why their VM system has given them a black screen, or why the image they just downloaded didn't work - it's basic user friendliness.

Again, to me that user friendliness would be provided by not telling people to download disk images, but by telling them to download configuration files, which get imported as a VM, at which point the application asks for the disk image.

Quoted 3 lines

It's not obvious why it's failed; if it was as simple as a nice box popping up telling them they'd booted it wouldn't be too bad; but some of them will waste 3 hours trying to figure out wth happened.

If they imported the config file instead of the disk first, they'd get the box.

Quoted 1 line

*seriously* think about our users.

The thing is that the only report I've heard about something like this is from myself. I always had issue with remembering to pump up the minimum amount of RAM required to boot a Linux image.

But I do realize that if the download page not only offered a raw disk image, but a qemu config file with it, I would have used it.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Simpler example; what stops you trying to put the PPC qcow image into your x86 VM system - nothing that I know of. I just want to stop the users shooting themselves in the foot.

They haven't shot themselves in the foot, they've just wasted a bit of their time, which could've been avoided by reading before clicking.

*seriously* think about our users.

I do and I realize that setting the machine type is not sufficient. What you are now asking for is an appliance.

I don't like to repeat myself again and again, but I do still think an appliance would be nice to have. *But*:

I do not think qemu is the right place to manage it, though I may be wrong. Also, you do not want it to make an appliance.

And most importantly, if we want appliances, we have to think seriously about it and not just handwave it as "Max doesn't want a tiny bit of data in a qcow2 file, what a party spoiler. Let's just force him or make someone else add support and start some random thing, because we gotta start somewhere, right?"

I do not get that impression from you, I should say. I do get the impression that you think more seriously about this than I do, but I also believe that you should gather what everybody wants instead of just arguing with me that it needs to be in qcow2.

I do not believe that I have any authority on what configuration options we need to store whatsoever. I can only give hunches there and what I'd find useful.

But I do believe that I have some authority over what makes sense in qcow2 and what doesn't. So if you get a consensus on what to store (and there is no consensus on that whatsoever), you can indeed make me add support in qcow2, because I believe at that point there will be very good arguments for adding such support.

So as long as we are in this thread which bears a "qcow" in its subject, I will respond and say "no".

Quoted 56 lines
Quoted 56 lines
Quoted 55 lines
Quoted 45 lines
Quoted 33 lines
Quoted 33 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.

Yes, but in the process you've made it completely opaque to qemu, basically, which doesn't really make it better for me. Not that qemu-specific information in qcow2 files would be what I want, but, well.

But it does solve technical issues, I concede that.

Quoted 3 lines

b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.

Quoted 7 lines
Quoted 3 lines

Not really. The string can be rather long, so you probably don't want to store it in the image header, and thus it's just a binary blob from qcow2's perspective, essentially.

Yes, but it's a single blob - I'm not asking for multiple keyed blobs or the ability to update individual blobs; just one blob that I can replace.

OK, you aren't, but others seem to be.

Or, well, you call it a single blob. But actually the current ideas seem to be to store a rather large configuration tree with binary data in that blob, so to me personally there is absolutely no functional difference to just storing a tar file in that blob.

Quoted 8 lines
Quoted 3 lines

So correct me if I'm wrong, but to me it appears that you effectively want to store a filesystem in qcow2.[1] Well, that's better than making qcow2 the filesystem, but it still appears just the wrong way around to me.

It's different in the sense that what we end up with is still a qcow2; anything that just handles qcow2's and can pass them through doesn't need to do anything different; users don't need to do anything different. No one has to pack/unpack the file.

Packing/unpacking is a strawman because I'm doing my best to give proposals that completely avoid that.

Quoted 6 lines

Users do need to do something different, because users do need to realize that today there is no way to store VM configuration and disk data in a single file. So if they already start VMs just based on a disk, then they are assuming behavior we do not have and that I'd call naive. But that is a strawman from my side, sorry. Keeping naive users happy is probably OK.

Remember this all works fine now and has done for many years; it's the addition of q35 that breaks that assumption.
The users can already blidly pick up the qcow2 image and stuff it in

Quoted 6 lines
Quoted 3 lines

Which probably was blind luck already. And if it wasn't, that means they knew the defaults are what they want. So now they'd know they aren't and they have to offer a config file along with the disk image.

No, it's not blind look; it's that the management tools know how to get it right.

Good! I mean it.

Quoted 10 lines
Quoted 7 lines
Quoted 1 line

and it all works; all I want is for that to keep working.

And all I say is that it's not unreasonable to expect users to realize that a VM is more than a disk image, just like a computer is more than a disk drive; and that handling two files really is not the end of the world.

(And neither is wasting someone's time because they can't read.)

*seriously* think about our users.

You haven't yet told me why expecting users to download two files instead of one is so bad. You just say they won't.

OK, so I'd say the VM config is more important. That should be displayed prominently and users should download that first, and that would be nice because we could trivially emit errors when users forget to download the disk images with them.

But you say that we unfortunately have reached a point where everyone already uses disk images and nobody uses config files, so training people to do something else is going to be practically impossible.

I can see your point, but I don't like that you accuse me of hating users when I'm just saying that they've been doing it wrong.

Also, blackmail doesn't work. As long as there is no consensus on what to store, I don't like being told "but it's so easy" and "it will help a great deal, you just hate our users".

Also, you were saying "shoot themselves in the foot". To me that meant they could seriously break something while that was apparently not the case. It just meant that they wasted some time, which yes, is bad enough (not least because time is money), but it's not the end of the world. That is what I meant by everything you replied to "think about our users".

Quoted 4 lines
Quoted 4 lines

Firstly, I agree it's a nice thing to have, but it's not worth it if we don't come up with clear rules on how to prevent developing a full appliance format.

Quoted 8 lines
Quoted 4 lines

Or maybe we want that (because I still believe that you can always come up with obscure options without which the VM won't boot in your specific case), but then this is beyond just storing a tiny bit of data in a qcow2 image.

I don't want to protect them from really trying to shoot themselves in the foot; I just want to make sure the easy-path works. Download an image, tell the tool to import; VM works. All good.

OK, good, that is a good use case that I understand. I have exactly two issues with it:

(1) I am not sure how far the easy path goes. Ultimately, it does mean an appliance to which in principle I am not opposed.

But there are many open questions for which there just is no consensus yet. What application is that appliance for? (qemu? libvirt? Some other management application?) Do we actually want a full-blown appliance? Do we really want just qcow2 for appliances?

Before these questions are answered in a consensus, there is just no reason to discuss what the best kind of representation is.

(2) And after this is answered, someone has to decide for themselves that they think working on this is important enough.

I do assume that once we (or you, because I do not have real authority there) have a consensus on (1), I believe that it will be evident whether we need qcow2 support, or more generally, what kind of qemu block layer support is required. I just ask of you not to assume you'll need qcow2 support beforehand.

Once you know you need qcow2 support for very specific reasons and for a rather specific use case, we can continue the qcow2-specific part. If you have good reasons and a specific use case that multiple people agree on, I will not oppose it and if I have the time, I can implement it myself, if you need me to.

But the current hand-waving where everyone I'm talking with wants something else (and nobody but you seems really clear about what they want specifically) really does not make me want to add or back support now.

[...]

Quoted 19 lines
Quoted 19 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines

I'm not talking about unpacking. I'm talking about a potentially new format which allows accessing the qcow2 file in-place. It would probably be trivial to write a block driver to allow this.

(And as I wrote in my response to Michal, I suspect that tar could actually allow this, even though it would probably not be the ideal format.)

As above, I don't think this is trivial; you have to change all the layers; lets say it was a tar; you'd have to somehow know that you're importing one of these special tars,

Quoted 5 lines
Quoted 2 lines

Which is trivial because it's just "Hey, look, it's a tar with that description file".

Trivial? It's taking 100+ mails to add a tag to a qcow2 file! Can you imagine what it takes to change libvirt, openstack, ovirt and the rest?

:-)

Quoted 7 lines
Quoted 3 lines

The implementation is trivial is what I meant, just like the implementation would be rather simple for qcow2 to store a binary blob and completely ignore it.

But then you'd have people shipping .newformat files as well as qcow2 files and you'd have to persuade people to start doing that, and they'd ship both or none or....

Hm. Reasonable point.

I mean, I'd say it's not so hard, for multiple reasons.

First, I'd say that our users can figure it out. But you don't think they can figure out downloading two files (which may be right! I can understand that people can't know everything about every single tool they use, and that it really is unreasonable to ask that of them, although I do believe that people can intuitively know that a VM needs a config file, which is why I'm still not of your exact opinion). So if they don't "want" to download two files, it is going to be difficult to make them provide the new format.

Secondly, as far as I have understood you (and I mean you and not e.g. Michael), you are mainly worried about the management layer. I would assume that the management layer could give users a specific way of exporting VMs which makes things simpler than them having to find the disk image themselves. This would make exporting in the new format trivial, because they'd do that automatically.

(This exporting process might allow exporting just the disk image, while emitting a warning that this does not include VM configuration options.)

Max

#127 lore raw
In reply to Michal Suchánek
Quoted 35 lines · Michal Suchánek
Quoted 11 lines · On Wed, 6 Jun 2018 16:55:08 +0200 Max Reitz <[email protected]> wrote:
Quoted 1 line · Dr. David Alan Gilbert

* Max Reitz ([email protected]) wrote:

[...]

Quoted 6 lines
Quoted 5 lines

So why is it so dangerous to connect a disk you just downloaded to e.g. the wrong machine type? I assumed it just wouldn't work and you'd try again, until you realized that maybe you should read the download description and do as it says ("download this config file, pass it").

Quoted 7 lines
Quoted 1 line

That's bad! Stuff should just-work;

That's how it always should be. Life's tough, though.

Quoted 1 line

it currently just works,

Due to sheer blind luck, I'd say.

It's TimeProvenSolution(tm).

Quoted 6 lines
Quoted 3 lines

things
should get better and easier for our users.

Users using a whole VM stack plus management, but then handling two files instead of one is too much to ask?

What you don't seem to realize is there are cases when there is an 'administrator' who has set up the VM stack plus management and 'joe user' who wants to run some random VM on that stack.

Quoted 5 lines

And if you download an appliance compatible with the stack it should just work. For a long time the 'appliance' for qemu based virtualization was a simple qcow2 file which was sized sufficiently for the VM to run but shrunk for transport. And although it is technically wrong it JustWorked(tm).

Hm, yes. As I replied to Dave, I understand, but I would think this then requires a real appliance solution. I think you do want such a solution, but Dave doesn't.

My problem is that I cannot accept Dave's arguments on why to include this blob in qcow2 if someone else already plans on making that blob the basis for qcow2 appliances.

And I still do not think that qcow2 is the right format for VM appliances. To convince me, we'd first need a consensus on what the appliances are for (Michael seems to want them for qemu directly, apparently you want them for something higher up the stack) and thus what they are supposed to be capable of exactly.

Like, one thing that is important to discuss is this (but please not in this thread...): If we agree on making an appliance format (qcow2 or not), is it for running VMs off or do we just want it for VM export/import? The former might mean we need qcow2, because there is no good way to offer good performance with multiple disks otherwise (but this would constrain us e.g. in the disk image format -- no raw images for you, then). But the latter can work just fine with a normal archival format as long as building/decomposing it is possible without copying.

(I would think that you can move blocks from one file to another, so with proper alignment you should be able to build/decompose an archive from/into its members without copying.)

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

And anyway, not
working for EFI for exmaple can be just a blank screen. Seriously
- keep it easy for the user!

Thinking this through makes you end up with appliances.

And those can in general have more than one disk.

Indeed. And thus knowing what we want is important so we can make a good decision on where to store it instead of just focusing on where it would be apparently simplest.

Max

#148 lore raw
In reply to Eduardo Habkost
Quoted 2 lines · Eduardo Habkost
Quoted 1 line · Max Reitz

On 2018-06-06 15:45, Michal Suchánek wrote:

[...]

Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

I understand that for some use cases simplifying the distribution of VMs as much as possible is quite important.

I don't because still nobody has explained it to me.

The only explanation I got so far was "People are lazy and we have defaults for everything, so we don't throw an error if people forget to pass a configuration file."

Quoted 6 lines

People don't pass a configuration file today because there's no standard for such a configuration file. qcow2 is already used today as an appliance file format because there's no better option. People download disk images from appliance and OS providers, import them into a cloud system, and it works out of the box because (luckily) "pc" is enough for most of them.

OK.

Quoted 5 lines

We can specify a true appliance file format, and ask people to use it. But then providers of single-disk appliances and OSes will need to publish two appliance images: qcow2 disk image for old systems that don't support the new format, and one in the new appliance format, for systems that support it.

True. This is a valid argument for making a compatible change to qcow2.
But: If these options are actually important, the qcow2 file is not
really compatible either. You might end up with a blank screen again.

Depending on how we'd design a new format, it might contain a config file and a qcow2 file which may be easily extractable. If so, users of legacy software could easily extract the qcow2 file and might even be tempted to look at the config file when it doesn't work, and maybe that could even help them.

Also, I think that it is not too unreasonable to ask providers to provide two formats.

But that does not make me disregard your argument. It is still valid, especially with your convenience note below.

(Providers could choose whether it is best for them to include the description in the qcow2 file, or whether to offer an archive that contains e.g. a raw file.)

Quoted 5 lines
Quoted 1 line

Which to me still just makes it an inconvenience.

Well, there are small inconveniences and there are big inconveniences that together make a system unnecessarily hard to use. I'd say this one falls somewhere in the middle.

Hm, OK.

Quoted 6 lines

[...]

Quoted 5 lines

I'm noticing a pattern here, and that is that everybody has a different opinion on what we actually want in the end, and it's just by chance that we find ourselves in two camps ("put it in qcow2" vs. "put it somewhere else").

Quoted 6 lines
Quoted 2 lines

Maybe we should first discuss what we actually want before we can discuss where to put it.

I'm inclined to agree. Once we figure out a good VM description format, we can justify a proposal to allow embedding the VM description in qcow2 for convenience.

OK.

Max

#128 lore raw
In reply to Max Reitz
Quoted 20 lines · On Wed, 6 Jun 2018 20:02:54 +0200 Max Reitz <[email protected]> wrote:
Quoted 13 lines · Michal Suchánek
Quoted 5 lines · On Wed, 6 Jun 2018 16:55:08 +0200 Max Reitz <[email protected]> wrote:
Quoted 1 line · Dr. David Alan Gilbert

* Max Reitz ([email protected]) wrote:

Users using a whole VM stack plus management, but then handling two files instead of one is too much to ask?

What you don't seem to realize is there are cases when there is an 'administrator' who has set up the VM stack plus management and 'joe user' who wants to run some random VM on that stack.

Quoted 5 lines

And if you download an appliance compatible with the stack it should just work. For a long time the 'appliance' for qemu based virtualization was a simple qcow2 file which was sized sufficiently for the VM to run but shrunk for transport. And although it is technically wrong it JustWorked(tm).

Quoted 3 lines

Hm, yes. As I replied to Dave, I understand, but I would think this then requires a real appliance solution. I think you do want such a solution, but Dave doesn't.

Yes, Dave wants a poor man's half-assed appliance and insists on it not being an appliance. Duh.

In the pc world to maintain the status quo with minimum changes you only need to know if the image uses EFI or legacy BIOS and you can maintain the illusion that the TimeProvenSolution(tm) JustWorks(tm).

Sneaking that single piece of information somewhere seems to be the goal here.

Quoted 8 lines

My problem is that I cannot accept Dave's arguments on why to include this blob in qcow2 if someone else already plans on making that blob the basis for qcow2 appliances.

And I still do not think that qcow2 is the right format for VM appliances. To convince me, we'd first need a consensus on what the appliances are for (Michael seems to want them for qemu directly,

Let's put this straight: qemu as is cannot run appliances. It is not designed for that and it would be a big feature to create enough management inside qemu (or around qemu but part of qemu distribution) to change that.

As it stands qemu always takes the configuration from the outside - either from the user directly or from a separate management layer.

Quoted 2 lines

apparently you want them for something higher up the stack) and thus what they are supposed to be capable of exactly.

Using qcow2 would be kind of cool but it has its limitations and drawbacks as well.

You could use qcow2 as transport format and convert the VM to use raw disks or whatever if you need the performance. And you could run the VM directly from qcow2 without additional processing which is its advantage.

It would fail miserably with tools not aware of the extra metadata, however.

Lastly we are missing a developer of a management layer committed to support such appliances.

Quoted 10 lines

Like, one thing that is important to discuss is this (but please not in this thread...): If we agree on making an appliance format (qcow2 or not), is it for running VMs off or do we just want it for VM export/import? The former might mean we need qcow2, because there is no good way to offer good performance with multiple disks otherwise (but this would constrain us e.g. in the disk image format -- no raw images for you, then). But the latter can work just fine with a normal archival format as long as building/decomposing it is possible without copying.

Indeed, using an archive should be good enough for the 1-click download solution. It will take time to extract but it will typically take even more time to download or publish. So optimizing the format for speed of export/import might be misplaced.

Thanks

Michal

#129 lore raw

On Wed, Jun 06, 2018 at 08:33:39PM +0200, Michal Suchánek wrote:
[...]

Quoted 2 lines

Lastly we are missing a developer of a management layer committed to support such appliances.

This is important. Without developers of management tools willing to help specify the requirements and implement the feature, all the work in the lower layers would be useless.

Signature · 1 line
Eduardo
#154 lore raw
In reply to Eric Blake
Quoted 9 lines · Eric Blake
Quoted 6 lines · Michael S. Tsirkin
Quoted 2 lines · Max Reitz

Yeah, but why make qcow2 that format?  That's what I completely fail to understand.

Because why not? It's cheap to add it there and is much easier than teaching people about a new container format.

tar is not a new container format, but it is a new format to various toolchains - that said, if we popularize tar as the format for including a config file alongside a qcow2 image, it's not that hard to fix the stack to start passing that file around as the new preferred file type.

On a completely different front, 'qcow2' as a file format comes with some psychological baggage. If someone was using it 8 years ago, before we did coroutine optimizations, it was noticeably slower than raw, and relatively easier to get into a corrupted image condition that resulted in data loss. Just one VM lost, and it leaves a sour taste in your mouth, where you are unwilling to trust that file format (even though the file format was not necessarily the cause of the corruption). Marketing-wise, we failed with our improvements ('qcow2v3' is so much more of a mouthful than 'qcow3'), and it took years to flip the defaults from v2 as the default to v3 as the default (moreso in downstream distros than upstream), in part because we couldn't convince people of the improvements they would be gaining by moving to v3. Historically, there's also 'qed' which was promised as a way to fix some of the poor performance of qcow2, but which ended up not being any better than our actual qcow2v3 improvements, so no one ended up switching to that. So, to some extent, various high-level consumers still have the notion that 'raw' files are better/safer/faster than 'qcow2' files because of an anecdote from years ago, even if we have since fixed the speed parity and added locking to eliminate careless data loss.

If we DO add a new tar-file block driver to qemu, that could serve as a marketing opportunity to convince people that the new format has all of the features that you can't get from just a raw file, and does not suffer from the slowness or data corruption they were worried about in qcow2. Thus, even if our new format is just a thin wrapper around a config file plus the existing qcow2v3 we already know and love, the mere fact that it is a new format may get people to move away from raw images in situations where just the name 'qcow2' is unable to do so, at which point we can help them take advantage of the features made possible by qcow2.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#155 lore raw

Hi,

Quoted 5 lines

our actual qcow2v3 improvements, so no one ended up switching to that. So, to some extent, various high-level consumers still have the notion that 'raw' files are better/safer/faster than 'qcow2' files because of an anecdote from years ago, even if we have since fixed the speed parity and added locking to eliminate careless data loss.

When I use raw images the reasons are different ones. Most of the time it is that I want use the image with something which isn't qemu and thus doesn't understand qcow2. Booting a image as container for example (systemd-nspawn -i $image.raw).

cheers,
Gerd

#78 lore raw
In reply to Daniel P. Berrangé
Quoted 15 lines · Daniel P. Berrangé
Quoted 7 lines · Eric Blake

But for the new config to be useful, you have to modify at least one tool in the path. At which point, it is just as easy to say: "libvirt is now smart enough to read the config file out of a .qcow2 to know that it should prefer a q35 machine" as it is to say "libvirt is now smart enough to treat a .tar file containing .qcow2 and a config file that states that it should prefer a q35 machine", and either approach requires just a single file for the user to download.

Just to be clear, libvirt isn't going to do either of those things.

Whether there is metadata stuffed inside qcow2, or in a metdata file inside a tar file, libvirt is not going to look inside either of them. The XML is the only place libvirt deals with the hardware config.

Quoted 8 lines

Extracting machine type is always going to be a job for the layer above such as OpenStack/OVirt/Virt-manager/etc. They will then decide whether or not they want to honour that info, and if so, put it into the XML they give to libvirt.

As mentioned elsewhere, IMHO, it is more friendly to those tools to use pre-existing formats, eg TAR and XML/JSON, for which their respective programming langauges already have APIs/parsers.

Something that I haven't seen mentioned in the thread - and this looks like as good a point as any to jump in - is that for q35 guests using EFI as well as aarch64 guests the "one click import" experience requires not only hints about the machine (and firmware!) type, but also a copy of the EFI variable store:

  $ virt-builder fedora-27 --arch aarch64 --notes
  Fedora® 27 Server (aarch64)

[...]

You will need to use the associated UEFI NVRAM variables file:
http://libguestfs.org/download/builder/fedora-27-aarch64-nvram.xz

While hints might be considered a reasonable fit for qcow2, I think it's pretty hard to argue for embedding the NVRAM file in there, which to me signals quite clearly that an archive containing the disk image(s) *and* the configuration hints *and* other ancillary files such as the NVRAM is the only way to build a solution that's not dead on arrival.

It's pretty easy then to imagine using something like

  $ virt-builder \
    fedora-27 \
    --arch aarch64 \
    --format qva \
    --output f27-aarch64.qva

or download the equivalent from some website, followed by

  $ virt-install \
    --name f27-aarch64 \
    --import \
    --input f27-aarch.qva

or the equivalent pointy-clicky import step and having things Just Work™, provided sufficient hints are included in the archive; the user, or the management application, would of course be able to override such hints at import time.

Signature · 1 line
Andrea Bolognani / Red Hat / Virtualization
#79 lore raw
Quoted 39 lines · Andrea Bolognani
Quoted 15 lines · Daniel P. Berrangé
Quoted 7 lines · Eric Blake

But for the new config to be useful, you have to modify at least one tool in the path. At which point, it is just as easy to say: "libvirt is now smart enough to read the config file out of a .qcow2 to know that it should prefer a q35 machine" as it is to say "libvirt is now smart enough to treat a .tar file containing .qcow2 and a config file that states that it should prefer a q35 machine", and either approach requires just a single file for the user to download.

Just to be clear, libvirt isn't going to do either of those things.

Whether there is metadata stuffed inside qcow2, or in a metdata file inside a tar file, libvirt is not going to look inside either of them. The XML is the only place libvirt deals with the hardware config.

Quoted 8 lines

Extracting machine type is always going to be a job for the layer above such as OpenStack/OVirt/Virt-manager/etc. They will then decide whether or not they want to honour that info, and if so, put it into the XML they give to libvirt.

As mentioned elsewhere, IMHO, it is more friendly to those tools to use pre-existing formats, eg TAR and XML/JSON, for which their respective programming langauges already have APIs/parsers.

Something that I haven't seen mentioned in the thread - and this looks like as good a point as any to jump in - is that for q35 guests using EFI as well as aarch64 guests the "one click import" experience requires not only hints about the machine (and firmware!) type, but also a copy of the EFI variable store:

  $ virt-builder fedora-27 --arch aarch64 --notes
  Fedora® 27 Server (aarch64)

[...]

You will need to use the associated UEFI NVRAM variables file:
http://libguestfs.org/download/builder/fedora-27-aarch64-nvram.xz

Quoted 6 lines

While hints might be considered a reasonable fit for qcow2, I think it's pretty hard to argue for embedding the NVRAM file in there, which to me signals quite clearly that an archive containing the disk image(s) *and* the configuration hints *and* other ancillary files such as the NVRAM is the only way to build a solution that's not dead on arrival.

On a similar theme, I can imagine users wanting to provide a TPM data blob too, and for AMD SEV we'd need to be able to provide a DH key, and session blob too IIUC.

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 :|
#88 lore raw
In reply to Andrea Bolognani
Quoted 6 lines · Andrea Bolognani

Something that I haven't seen mentioned in the thread - and this looks like as good a point as any to jump in - is that for q35 guests using EFI as well as aarch64 guests the "one click import" experience requires not only hints about the machine (and firmware!) type, but also a copy of the EFI variable store:

Quoted 7 lines
  $ virt-builder fedora-27 --arch aarch64 --notes
  Fedora® 27 Server (aarch64)

[...]

You will need to use the associated UEFI NVRAM variables file:
http://libguestfs.org/download/builder/fedora-27-aarch64-nvram.xz

This is true, although only sometimes. If the bootloader[*] has a working fallback path then usually it is able to boot and reset the UEFI varstore back to the correct values. We have had bugs before where the fallback path was not working, eg:

https://bugzilla.redhat.com/show_bug.cgi?id=1353689 (yours!)
https://bugzilla.redhat.com/show_bug.cgi?id=1558793

Another problem which Laszlo mentioned is the varstore isn't portable between UEFI implementations, or if the UEFI is compiled with different options. You can even imagine shipping multiple varstores(!) which argues for a tar-like format.

Quoted 6 lines

While hints might be considered a reasonable fit for qcow2, I think it's pretty hard to argue for embedding the NVRAM file in there, which to me signals quite clearly that an archive containing the disk image(s) *and* the configuration hints *and* other ancillary files such as the NVRAM is the only way to build a solution that's not dead on arrival.

The tar argument is quite strong. Just not the wretched OVA/OVF :-)

Quoted 15 lines

It's pretty easy then to imagine using something like

  $ virt-builder \
    fedora-27 \
    --arch aarch64 \
    --format qva \
    --output f27-aarch64.qva

or download the equivalent from some website, followed by

  $ virt-install \
    --name f27-aarch64 \
    --import \
    --input f27-aarch.qva
Quoted 4 lines

or the equivalent pointy-clicky import step and having things Just Work™, provided sufficient hints are included in the archive; the user, or the management application, would of course be able to override such hints at import time.

RFEs for virt-builder & virt-install one day :-)

Rich.

[*] I'm not sure exactly which bit of the bootloader does this, whether it's UEFI itself, or the grub-efi in the guest.

Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
#89 lore raw
Quoted 20 lines · * Richard W.M. Jones ([email protected]) wrote:
Quoted 6 lines · Andrea Bolognani

Something that I haven't seen mentioned in the thread - and this looks like as good a point as any to jump in - is that for q35 guests using EFI as well as aarch64 guests the "one click import" experience requires not only hints about the machine (and firmware!) type, but also a copy of the EFI variable store:

Quoted 7 lines
  $ virt-builder fedora-27 --arch aarch64 --notes
  Fedora® 27 Server (aarch64)

[...]

You will need to use the associated UEFI NVRAM variables file:
http://libguestfs.org/download/builder/fedora-27-aarch64-nvram.xz

This is true, although only sometimes. If the bootloader[*] has a working fallback path then usually it is able to boot and reset the UEFI varstore back to the correct values. We have had bugs before where the fallback path was not working, eg:

Quoted 7 lines

https://bugzilla.redhat.com/show_bug.cgi?id=1353689 (yours!)
https://bugzilla.redhat.com/show_bug.cgi?id=1558793

Another problem which Laszlo mentioned is the varstore isn't portable between UEFI implementations, or if the UEFI is compiled with different options. You can even imagine shipping multiple varstores(!) which argues for a tar-like format.

Given that level of incompatibility with var stores (which I've seen myself) I don't see how you can distribute them with images.

Dave

Quoted 29 lines
Quoted 6 lines

While hints might be considered a reasonable fit for qcow2, I think it's pretty hard to argue for embedding the NVRAM file in there, which to me signals quite clearly that an archive containing the disk image(s) *and* the configuration hints *and* other ancillary files such as the NVRAM is the only way to build a solution that's not dead on arrival.

The tar argument is quite strong. Just not the wretched OVA/OVF :-)

Quoted 15 lines

It's pretty easy then to imagine using something like

  $ virt-builder \
    fedora-27 \
    --arch aarch64 \
    --format qva \
    --output f27-aarch64.qva

or download the equivalent from some website, followed by

  $ virt-install \
    --name f27-aarch64 \
    --import \
    --input f27-aarch.qva
Quoted 4 lines

or the equivalent pointy-clicky import step and having things Just Work™, provided sufficient hints are included in the archive; the user, or the management application, would of course be able to override such hints at import time.

Quoted 14 lines

RFEs for virt-builder & virt-install one day :-)

Rich.

[*] I'm not sure exactly which bit of the bootloader does this, whether it's UEFI itself, or the grub-efi in the guest.

Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#90 lore raw
In reply to Richard W.M. Jones
Quoted 20 lines · Richard W.M. Jones
Quoted 6 lines · Andrea Bolognani

Something that I haven't seen mentioned in the thread - and this looks like as good a point as any to jump in - is that for q35 guests using EFI as well as aarch64 guests the "one click import" experience requires not only hints about the machine (and firmware!) type, but also a copy of the EFI variable store:

Quoted 7 lines
  $ virt-builder fedora-27 --arch aarch64 --notes
  Fedora® 27 Server (aarch64)

[...]

You will need to use the associated UEFI NVRAM variables file:
http://libguestfs.org/download/builder/fedora-27-aarch64-nvram.xz

This is true, although only sometimes. If the bootloader[*] has a working fallback path then usually it is able to boot and reset the UEFI varstore back to the correct values. We have had bugs before where the fallback path was not working, eg:

Quoted 7 lines

https://bugzilla.redhat.com/show_bug.cgi?id=1353689 (yours!)
https://bugzilla.redhat.com/show_bug.cgi?id=1558793

Another problem which Laszlo mentioned is the varstore isn't portable between UEFI implementations, or if the UEFI is compiled with different options. You can even imagine shipping multiple varstores(!) which argues for a tar-like format.

Could we perhaps imagine shipping the actual UEFI bios, rather than only the varstore. The bios blob runs in guest context, so there shouldn't be able security concerns from hosting vendors with running user provided bios. Mostly its a matter of confidence that the interface between bios & qemu is stable which feels easier than assuming varstore vs different bios is portable. IIRC, shipping actual UEFI BIOS is something that was desirable for AMD SEV usage.

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 :|
#98 lore raw
In reply to Richard W.M. Jones
Quoted 22 lines · Richard W.M. Jones
Quoted 6 lines · Andrea Bolognani

Something that I haven't seen mentioned in the thread - and this looks like as good a point as any to jump in - is that for q35 guests using EFI as well as aarch64 guests the "one click import" experience requires not only hints about the machine (and firmware!) type, but also a copy of the EFI variable store:

Quoted 7 lines
  $ virt-builder fedora-27 --arch aarch64 --notes
  Fedora® 27 Server (aarch64)

[...]

You will need to use the associated UEFI NVRAM variables file:
http://libguestfs.org/download/builder/fedora-27-aarch64-nvram.xz

This is true, although only sometimes. If the bootloader[*] has a working fallback path then usually it is able to boot and reset the UEFI varstore back to the correct values. We have had bugs before where the fallback path was not working, eg:

https://bugzilla.redhat.com/show_bug.cgi?id=1353689 (yours!)
https://bugzilla.redhat.com/show_bug.cgi?id=1558793

[...]

Quoted 2 lines

[*] I'm not sure exactly which bit of the bootloader does this, whether it's UEFI itself, or the grub-efi in the guest.

IIUC the UEFI spec itself reserves certain file names in the ESP for this fallback mechanism; it's then up to the guest operating system to actually install something appropriate there.

In Fedora and RHEL, shim is what takes care of it (except when it doesn't ;), but in Debian and Ubuntu AFAIK shim is not included and the fallback path doesn't work at all, which makes providing the NVRAM file a hard requirement to boot such guests.

Signature · 1 line
Andrea Bolognani / Red Hat / Virtualization
#91 lore raw
In reply to Daniel P. Berrangé
Quoted 6 lines · Daniel P. Berrangé
Quoted 4 lines · Richard W.M. Jones

Another problem which Laszlo mentioned is the varstore isn't portable between UEFI implementations, or if the UEFI is compiled with different options. You can even imagine shipping multiple varstores(!) which argues for a tar-like format.

Quoted 7 lines

Could we perhaps imagine shipping the actual UEFI bios, rather than only the varstore. The bios blob runs in guest context, so there shouldn't be able security concerns from hosting vendors with running user provided bios. Mostly its a matter of confidence that the interface between bios & qemu is stable which feels easier than assuming varstore vs different bios is portable.

That sounds sensible, and further reinforces the idea that we need way more than a single string baked into the qcow2 file.

Signature · 1 line
Andrea Bolognani / Red Hat / Virtualization
#80 lore raw
In reply to Daniel P. Berrangé
Quoted 11 lines · Daniel P. Berrangé
Quoted 6 lines · Andrea Bolognani

While hints might be considered a reasonable fit for qcow2, I think it's pretty hard to argue for embedding the NVRAM file in there, which to me signals quite clearly that an archive containing the disk image(s) *and* the configuration hints *and* other ancillary files such as the NVRAM is the only way to build a solution that's not dead on arrival.

On a similar theme, I can imagine users wanting to provide a TPM data blob too, and for AMD SEV we'd need to be able to provide a DH key, and session blob too IIUC.

I'm not familiar with the technologies you're talking about, but all that sounds like something very security sensitive and not something eg. the Fedora project would want to bake into their cloud images.

Perhaps we should keep in mind that this kind of archive format lends itself quite naturally to both generic ready-made images and custom, fully configured images: in the former case it would only contain the few things mentione above, while in the latter it might also have security sensitive data that's specific to the deployment it's going to be used against.

For non-vanilla images, it might be interesting to include the libvirt XML in its entirety, which would make it trivial to keep around a full-contained copy of a guest that can be imported back into libvirt with a single click; on the other hand, the management layer might want to override that, and for generic images we probably want to avoid the security implications of people importing potentially untrusted configurations into the system libvirt instance and stick to just a few hints instead.

So there's at least two partially overlapping use cases right there. Fun :)

Signature · 1 line
Andrea Bolognani / Red Hat / Virtualization
#81 lore raw
Quoted 18 lines · Andrea Bolognani
Quoted 11 lines · Daniel P. Berrangé
Quoted 6 lines · Andrea Bolognani

While hints might be considered a reasonable fit for qcow2, I think it's pretty hard to argue for embedding the NVRAM file in there, which to me signals quite clearly that an archive containing the disk image(s) *and* the configuration hints *and* other ancillary files such as the NVRAM is the only way to build a solution that's not dead on arrival.

On a similar theme, I can imagine users wanting to provide a TPM data blob too, and for AMD SEV we'd need to be able to provide a DH key, and session blob too IIUC.

I'm not familiar with the technologies you're talking about, but all that sounds like something very security sensitive and not something eg. the Fedora project would want to bake into their cloud images.

Quoted 6 lines

Perhaps we should keep in mind that this kind of archive format lends itself quite naturally to both generic ready-made images and custom, fully configured images: in the former case it would only contain the few things mentione above, while in the latter it might also have security sensitive data that's specific to the deployment it's going to be used against.

I don't thonk there's any such distinction. A downstream user may build generic ready-made images, or fully configured app specific images. Both can contain the security sensitive data.

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 :|
#82 lore raw
Quoted 26 lines · * Daniel P. Berrangé ([email protected]) wrote:
Quoted 18 lines · Andrea Bolognani
Quoted 11 lines · Daniel P. Berrangé
Quoted 6 lines · Andrea Bolognani

While hints might be considered a reasonable fit for qcow2, I think it's pretty hard to argue for embedding the NVRAM file in there, which to me signals quite clearly that an archive containing the disk image(s) *and* the configuration hints *and* other ancillary files such as the NVRAM is the only way to build a solution that's not dead on arrival.

On a similar theme, I can imagine users wanting to provide a TPM data blob too, and for AMD SEV we'd need to be able to provide a DH key, and session blob too IIUC.

I'm not familiar with the technologies you're talking about, but all that sounds like something very security sensitive and not something eg. the Fedora project would want to bake into their cloud images.

Quoted 6 lines

Perhaps we should keep in mind that this kind of archive format lends itself quite naturally to both generic ready-made images and custom, fully configured images: in the former case it would only contain the few things mentione above, while in the latter it might also have security sensitive data that's specific to the deployment it's going to be used against.

Quoted 3 lines

I don't thonk there's any such distinction. A downstream user may build generic ready-made images, or fully configured app specific images. Both can contain the security sensitive data.

Including the nvram and efi makes me nervous; but I can see why together they might work. However, there's no guarantee that EFI has been tested with the QEMU it's used on and ... that could be trouble. Also, if we're going to start including the EFI rom then that would have to be migrated with the VM so that after a restart on a different host it's still using the right ROM that's compatible with it's varfile.

Dave

Quoted 6 lines

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 :|

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#83 lore raw
Quoted 3 lines · Dr. David Alan Gilbert

Including the nvram and efi makes me nervous; but I can see why together they might work. However, there's no guarantee that EFI has been tested with the QEMU it's used on and ... that could be trouble.

If the QEMU binary doesn't support EFI, then a guest expecting EFI won't be able to start regardless of where the EFI ROM came from.

Quoted 3 lines

Also, if we're going to start including the EFI rom then that would have to be migrated with the VM so that after a restart on a different host it's still using the right ROM that's compatible with it's varfile.

That's a problem that needs to be addressed anyway, because even as it is now you could easily find yourself trying and failing to migrate a guest between two hosts that have different and incompatible EFI ROMs installed.

Signature · 1 line
Andrea Bolognani / Red Hat / Virtualization
#84 lore raw
Quoted 8 lines · * Andrea Bolognani ([email protected]) wrote:
Quoted 3 lines · Dr. David Alan Gilbert

Including the nvram and efi makes me nervous; but I can see why together they might work. However, there's no guarantee that EFI has been tested with the QEMU it's used on and ... that could be trouble.

If the QEMU binary doesn't support EFI, then a guest expecting EFI won't be able to start regardless of where the EFI ROM came from.

No, I mean if the QEMU doesn't support that *particular* EFI.

Quoted 8 lines
Quoted 3 lines

Also, if we're going to start including the EFI rom then that would have to be migrated with the VM so that after a restart on a different host it's still using the right ROM that's compatible with it's varfile.

That's a problem that needs to be addressed anyway, because even as it is now you could easily find yourself trying and failing to migrate a guest between two hosts that have different and incompatible EFI ROMs installed.

True; although I was working on the basis that vendors who cared about migration compatibility would couple the EFI versions with machine types to ensure that the variable data didn't become incompatible.

Dave

Quoted 2 lines
Signature · 1 line
Andrea Bolognani / Red Hat / Virtualization

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#85 lore raw
Quoted 11 lines · Dr. David Alan Gilbert
Quoted 8 lines · * Andrea Bolognani ([email protected]) wrote:
Quoted 3 lines · Dr. David Alan Gilbert

Including the nvram and efi makes me nervous; but I can see why together they might work. However, there's no guarantee that EFI has been tested with the QEMU it's used on and ... that could be trouble.

If the QEMU binary doesn't support EFI, then a guest expecting EFI won't be able to start regardless of where the EFI ROM came from.

No, I mean if the QEMU doesn't support that *particular* EFI.

I could be wrong, but I feel like it's significantly less likely that a random QEMU binary won't like a random EFI ROM than it is for a random EFI ROM to not like a random EFI NVRAM.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

Also, if we're going to start including the EFI rom then that would have to be migrated with the VM so that after a restart on a different host it's still using the right ROM that's compatible with it's varfile.

Quoted 8 lines
Quoted 4 lines

That's a problem that needs to be addressed anyway, because even as it is now you could easily find yourself trying and failing to migrate a guest between two hosts that have different and incompatible EFI ROMs installed.

True; although I was working on the basis that vendors who cared about migration compatibility would couple the EFI versions with machine types to ensure that the variable data didn't become incompatible.

As far as I know, nobody is actually doing this at the moment.

Signature · 1 line
Andrea Bolognani / Red Hat / Virtualization
#86 lore raw
Quoted 11 lines · * Andrea Bolognani ([email protected]) wrote:
Quoted 10 lines · Dr. David Alan Gilbert
Quoted 8 lines · * Andrea Bolognani ([email protected]) wrote:
Quoted 3 lines · Dr. David Alan Gilbert

Including the nvram and efi makes me nervous; but I can see why together they might work. However, there's no guarantee that EFI has been tested with the QEMU it's used on and ... that could be trouble.

If the QEMU binary doesn't support EFI, then a guest expecting EFI won't be able to start regardless of where the EFI ROM came from.

Quoted 5 lines
Quoted 1 line

No, I mean if the QEMU doesn't support that *particular* EFI.

I could be wrong, but I feel like it's significantly less likely that a random QEMU binary won't like a random EFI ROM than it is for a random EFI ROM to not like a random EFI NVRAM.

True, but it's not that rare to find SeaBIOS+qemu version problems; so I'll assume the same happens with EFI.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

Also, if we're going to start including the EFI rom then that would have to be migrated with the VM so that after a restart on a different host it's still using the right ROM that's compatible with it's varfile.

That's a problem that needs to be addressed anyway, because even as it is now you could easily find yourself trying and failing to migrate a guest between two hosts that have different and incompatible EFI ROMs installed.

Quoted 5 lines
Quoted 3 lines

True; although I was working on the basis that vendors who cared about migration compatibility would couple the EFI versions with machine types to ensure that the variable data didn't become incompatible.

As far as I know, nobody is actually doing this at the moment.

I'm assuming we'll have to.

Dave

Quoted 2 lines
Signature · 1 line
Andrea Bolognani / Red Hat / Virtualization

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#130 lore raw
In reply to Eduardo Habkost
Quoted 8 lines · Eduardo Habkost

On Wed, Jun 06, 2018 at 08:33:39PM +0200, Michal Suchánek wrote:
[...]

Quoted 2 lines

Lastly we are missing a developer of a management layer committed to support such appliances.

This is important. Without developers of management tools willing to help specify the requirements and implement the feature, all the work in the lower layers would be useless.

FWIW, I'm following along from the OpenStack 'Nova' (it allows you to provision VMs / QEMU instances) point of view.

Here is a bug (filed by Eduardo) that is tracking what needs to fixed in Nova:

https://bugzilla.redhat.com/show_bug.cgi?id=1581414 -- OpenStack shouldn't break if the default machine-type in QEMU is "q35"

Refer to comment#6 and comment#11 for some analysis as to where Nova makes assumptions for machine types. (There is one instance of it.)

Related: Elsewhere on this KM-long thread, Dan Berrangé and myself have noted how Nova allows configuring machine types today -- either via setting a config attribute (in /etc/nova/nova.conf) per Compute node (where QEMU processes are launched) or via setting a metadata property per template disk image, which is used to launch Nova instances (VMs).

Signature · 1 line
/kashyap
#92 lore raw
In reply to Andrea Bolognani
Quoted 15 lines · Andrea Bolognani
Quoted 6 lines · Daniel P. Berrangé
Quoted 4 lines · Richard W.M. Jones

Another problem which Laszlo mentioned is the varstore isn't portable between UEFI implementations, or if the UEFI is compiled with different options. You can even imagine shipping multiple varstores(!) which argues for a tar-like format.

Quoted 7 lines

Could we perhaps imagine shipping the actual UEFI bios, rather than only the varstore. The bios blob runs in guest context, so there shouldn't be able security concerns from hosting vendors with running user provided bios. Mostly its a matter of confidence that the interface between bios & qemu is stable which feels easier than assuming varstore vs different bios is portable.

Quoted 3 lines

That sounds sensible, and further reinforces the idea that we need way more than a single string baked into the qcow2 file.

Sorry for arriving late (thanks Rich for the Fwd).

The contents of the non-volatile UEFI variables should be considered part of (permanent) guest state, such as disk contents. Therefore I'd argue for bundling the varstore file with the disk image(s).

In turn, the best way to ensure comaptibility between varstore and firmware binary is to just bundle the firmware binary as well. It's generally not large (x86) or if it is, it compresses extremely well (aarch64). For extra politeness, image providers can bundle a text file with their firmware build options (like a kernel config), possibly even a JSON document conforming to the new firmware schema (qemu commit 3a0adfc9bfcf), but that's not a hard requirement I guess.

If such a VM is to be migrated between hosts, I'd expect the host admin to take care of installing the fw binary on all eligible hosts.

Regarding compat between QEMU and firmware binary, I see three cases:

(1) Static requirements presented by the firmware for the QEMU configuration. (Such as -D SMM_REQUIRE.) With the domain configuration captured one way or another alongside the disk image anyway, this should not be a problem.

(2) New firmware launched on old QEMU. The firmware generally detects or negotiates features with QEMU, so this should be safe.

(Discounting firmware regressions, of course -- for example, search
<https://www.mail-archive.com/[email protected]/msg471901.html> for the string "I messed up".)

(3) Old firmware launched on new QEMU. This scenario has given us a lot more grief than (2), but I think for the appliance distribution use case, it can be folded into case (1) above -- specify the machine type too in the domain config, and that should be compatible with the old firmware.

(The handling of (3) is not uniform between upstream QEMU and various downstreams. For example, consider
<https://bugs.launchpad.net/qemu/+bug/1715700>. This was a latent bug in OVMF that got exposed by a new QEMU (due to a valid QEMU change), even when using old machine types. The upstream solution was to fix edk2 and stick with QEMU as-was (although the agreement around that hadn't been universal). Conversely, one downstream solution was to restrict the otherwise valid QEMU change to new machine types
<https://bugzilla.redhat.com/show_bug.cgi?id=1489800#c5>.)

All in all I agree with Daniel's proposal; it seems to be the most robust one.

And, I too recall that, under AMD SEV, users will be supposed to, or allowed to, provide their own firmware binaries.

Thanks!
Laszlo

#99 lore raw
In reply to Andrea Bolognani
Quoted 28 lines · Andrea Bolognani
Quoted 22 lines · Richard W.M. Jones
Quoted 6 lines · Andrea Bolognani

Something that I haven't seen mentioned in the thread - and this looks like as good a point as any to jump in - is that for q35 guests using EFI as well as aarch64 guests the "one click import" experience requires not only hints about the machine (and firmware!) type, but also a copy of the EFI variable store:

Quoted 7 lines
  $ virt-builder fedora-27 --arch aarch64 --notes
  Fedora® 27 Server (aarch64)

[...]

You will need to use the associated UEFI NVRAM variables file:
http://libguestfs.org/download/builder/fedora-27-aarch64-nvram.xz

This is true, although only sometimes. If the bootloader[*] has a working fallback path then usually it is able to boot and reset the UEFI varstore back to the correct values. We have had bugs before where the fallback path was not working, eg:

https://bugzilla.redhat.com/show_bug.cgi?id=1353689 (yours!)
https://bugzilla.redhat.com/show_bug.cgi?id=1558793

[...]

Quoted 2 lines

[*] I'm not sure exactly which bit of the bootloader does this, whether it's UEFI itself, or the grub-efi in the guest.

Quoted 8 lines

IIUC the UEFI spec itself reserves certain file names in the ESP for this fallback mechanism; it's then up to the guest operating system to actually install something appropriate there.

In Fedora and RHEL, shim is what takes care of it (except when it doesn't ;), but in Debian and Ubuntu AFAIK shim is not included and the fallback path doesn't work at all, which makes providing the NVRAM file a hard requirement to boot such guests.

Quoting the UEFI-2.7 spec:

Quoted 8 lines

3.4.3 Boot Option Variables Default Boot Behavior

[...] the boot options require a standard default behavior in the exceptional case that valid boot options are not present on a platform. The default behavior must be invoked any time the BootOrder variable does not exist or only points to nonexistent boot options, or if no entry in BootOrder can successfully be executed.

Quoted 5 lines

If system firmware supports boot option recovery as described in Section 3.4, system firmware must include a PlatformRecovery#### variable specifying a short-form File Path Media Device Path (see Section 3.1.2) containing the platform default file path for removable media (see Table 11). [...]

(Note from Laszlo: think '\EFI\BOOT\BOOTX64.EFI' on the system disk's EFI System Partition.)

Quoted 6 lines

It is expected that this default boot will load an operating system or a maintenance utility.

If this is an operating system setup program it is then responsible for setting the requisite environment variables for subsequent boots. [...]

More details:
<https://blog.uncooperative.org/blog/2014/02/06/the-efi-system-partition/>.

Thanks
Laszlo

#87 lore raw
In reply to Dr. David Alan Gilbert

Hi,

Quoted 5 lines
Quoted 3 lines

I could be wrong, but I feel like it's significantly less likely that a random QEMU binary won't like a random EFI ROM than it is for a random EFI ROM to not like a random EFI NVRAM.

True, but it's not that rare to find SeaBIOS+qemu version problems;

Hmm? Any recent examples? Since we switched over to have qemu generate the acpi tables instead of expecting the firmware doing it (qemu 1.5 or 1.6 IIRC) there where no hard lockstep updates. Only soft dependencies a'la "if you want use the new qemu feature foo you also need a seabios supporting the new feature foo".

Quoted 1 line

so I'll assume the same happens with EFI.

We try to avoid it but sometimes it doesn't work out as we like.

cheers,
Gerd

#97 lore raw
In reply to Daniel P. Berrangé
Quoted 24 lines · Daniel P. Berrangé
Quoted 23 lines · Richard W.M. Jones
Quoted 6 lines · Andrea Bolognani

Something that I haven't seen mentioned in the thread - and this looks like as good a point as any to jump in - is that for q35 guests using EFI as well as aarch64 guests the "one click import" experience requires not only hints about the machine (and firmware!) type, but also a copy of the EFI variable store:

Quoted 7 lines
  $ virt-builder fedora-27 --arch aarch64 --notes
  Fedora® 27 Server (aarch64)

[...]

You will need to use the associated UEFI NVRAM variables file:
http://libguestfs.org/download/builder/fedora-27-aarch64-nvram.xz

This is true, although only sometimes. If the bootloader[*] has a working fallback path then usually it is able to boot and reset the UEFI varstore back to the correct values. We have had bugs before where the fallback path was not working, eg:

https://bugzilla.redhat.com/show_bug.cgi?id=1353689 (yours!)
https://bugzilla.redhat.com/show_bug.cgi?id=1558793

Quoted 7 lines
Quoted 4 lines

Another problem which Laszlo mentioned is the varstore isn't portable between UEFI implementations, or if the UEFI is compiled with different options. You can even imagine shipping multiple varstores(!) which argues for a tar-like format.

Could we perhaps imagine shipping the actual UEFI bios, rather than only the varstore.

That's pretty unusual, UEFI is designed to abstract away the hardware. It normally ships with the hardware.

I don't think it's a good idea to stick firmware itself in the image:
updating guest images is already a problem, at least we can easily fix firmware bugs by dnf update on the host.

Quoted 3 lines

The bios blob runs in guest context,
so there shouldn't be able security concerns from hosting vendors with running user provided bios.

It seems possible that users that do supply their own firmware will want to save it with the image. I don't think we should do it for the standard firmware.

Quoted 5 lines

Mostly its a matter
of confidence that the interface between bios & qemu is stable which feels easier than assuming varstore vs different bios is portable. IIRC, shipping actual UEFI BIOS is something that was desirable for AMD SEV usage.

For SEV storing the un-encrypted binary, having QEMU read it out and write it into guest memory isn't any better than shipping it with QEMU.

Quoted 7 lines

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 :|
#96 lore raw
In reply to Andrea Bolognani
Quoted 15 lines · Andrea Bolognani
Quoted 6 lines · Daniel P. Berrangé
Quoted 4 lines · Richard W.M. Jones

Another problem which Laszlo mentioned is the varstore isn't portable between UEFI implementations, or if the UEFI is compiled with different options. You can even imagine shipping multiple varstores(!) which argues for a tar-like format.

Quoted 7 lines

Could we perhaps imagine shipping the actual UEFI bios, rather than only the varstore. The bios blob runs in guest context, so there shouldn't be able security concerns from hosting vendors with running user provided bios. Mostly its a matter of confidence that the interface between bios & qemu is stable which feels easier than assuming varstore vs different bios is portable.

Quoted 2 lines

That sounds sensible, and further reinforces the idea that we need way more than a single string baked into the qcow2 file.

I don't think anyone said we want a single string. What was proposed is a set of key value pairs with values being binary blobs.

Quoted 2 lines
Signature · 1 line
Andrea Bolognani / Red Hat / Virtualization
#103 lore raw
In reply to Max Reitz
Quoted 34 lines · Max Reitz
Quoted 33 lines · Michael S. Tsirkin
Quoted 31 lines · Max Reitz
Quoted 19 lines · Dr. David Alan Gilbert
Quoted 6 lines · * Max Reitz ([email protected]) wrote:
Quoted 5 lines · Dr. David Alan Gilbert
Quoted 4 lines · * Max Reitz ([email protected]) wrote:
Quoted 3 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Max Reitz ([email protected]) wrote:
Quoted 1 line · Dr. David Alan Gilbert

<reawakening a fizzled out thread>

<snip>

Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The problem with having a separate file is that you either have to copy it around with the image

Which is just an inconvenience.

It's more than that; if it's a separate file then the tools can't rely on users supplying it, and frankly they won't and they'll still just supply an image.

Quoted 5 lines
Quoted 1 line

At which point you throw an error and tell them to specify the config file.

No:
a) At the moment they get away with it for images since they're all 'pc' and the management layers do the right thing.

So so far nobody has complained? I don't really see the problem then.

If deploying a disk and using all the defaults works out for users, great. If they want more options, apparently they already know they have to provide some config.

Quoted 6 lines
Quoted 3 lines

QEMU's usability is terrible. There are tons of tools out there to try to tame it, but of course they lack the knowledge of the VM internals that QEMU has.

Er, yeah, OK. But it was my understanding that we decided that we have a management layer on top of qemu to make things simple.

Who's we? I don't think the QEMU community completely gave up on people using QEMU directly. It will need to be much more user-friendly than it is right now. But it's possible. Fabrice built an emulator in javascript, you go to a URL bam it runs a VM.

Quoted 1 line

Also, this is once more a case of first deciding what we want at all.

Who's we here again? Different people want different things. Enough people seem to want to store tagged data with a disk image that it might be worth someone's while to try to add that capability for starters to qemu-img.

Quoted 3 lines

Dave wants configuration options for the upper management layer which are completely opaque to qemu. That has nothing to do whatsoever with the usability of qemu itself.

That's why I keep saying, let's start with implementing a mechanism, worry about policy later if at all.

Quoted 24 lines
Quoted 10 lines
Quoted 10 lines
Quoted 3 lines

b) They'll give the wrong config file - then you'd need to add a flag to detect that - which means you'd need to add something to the qcow to match it to the config; loop back to teh start!

I'm not sure how seriously I should take this argument. Do stupid things, win stupid prizes.

If that's the issue, add a UUID to qcow2 files and reference it from the config file.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

We should make this EASY for users.

To me, having a simple config file they can edit manually certainly seems simpler than having to use specific tools to edit it inside of the qcow2 file.

I think you are one of the happy users familiar with qemu intricacies and/or using a tool on top that does it for you.

Yeah, virt-manager and sometimes libvirt directly. Works nicely. In any case, having to manage more than a single file was never one of my worries. In fact, I never had to manage any file because both tools do it for me.

Quoted 4 lines

And again, I don't know what the usability of qemu has to do with what Dave is proposing.

[...]

I think what we are seeing here is many people jumping on the bandwagon and finding more and more uses for ability to store meta-data in the qcow2 file.

This just means we should make it flexible enough to possibly support more uses. It does not mean we need to make it read mail on day 1.

Quoted 10 lines
Quoted 4 lines
Quoted 2 lines

Because I think (maybe I'm wrong, though) where to store it heavily depends on what we want to store and how we want to use it.

I don't really see why.

For instance, supporting full-blown appliances would mean supporting multiple images. Maybe in multiple formats. Maybe the user wants runtime performance and is willing to give up a bit of installation time for that (e.g. for unpacking an archive).

Quoted 8 lines

In any case, if we want to be able to configure every kind of VM, tying everything to qcow2 seems like a bad idea. First defining a format and then deciding on whether it makes sense to be able to put it into qcow2 for certain subcases seems much more reasonable.

And if you make the format decidedly qcow2-independent, the whole "putting it into qcow2 is the simplest implementation" argument becomes rather weak.

I don't see why. Yes I think it's a separate format that we should just allow storing in qcow2 for usability.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

I've not seen anything that's not for either:
a) The user to know what the image is

I thought the use case was they just downloaded it.

Otherwise, they should manage their filenames reasonably, come on. Seriously, adding a cute picture because users are too stupid to manage their VMs is *not* qcow2's problem.

Quoted 6 lines
Quoted 3 lines

QEMU is hard to use right and it is QEMU's problem. Users aren't stupid but neither do they have the time to learn internals of the tools they use.

Technically, it's the users' problem.
It may be qemu's fault, though.

I find solving peoblems interesting. I don't find assigning blame interesting.

Quoted 32 lines

I will not say it is qemu's fault, because I was always told we have a management layer to make things simple again. "qemu worries about execution, management layer worries about policy" is what I was told.

Also, I have no idea what you are talking about. I gave a very specific example. How is adding a picture to a VM disk image going to help anyone? If that's the issue people are facing, I would argue they probably have a multitude of different issues with using qemu, because I fully agree with you on that point -- using qemu for complex cases is hard. Well, no, it's simple, really, but then you probably won't get the best out of it. (As can be seen by the fact that some people seem to start their VM just based on a disk image, and that seems to work...)

So, using qemu in the best way possible is hard. But a pictogram in a disk image will not solve that problem. I was always told that using a management layer solves the problem. And as I understood, this was what Dave's proposal was about, the management layer, not qemu.

I would expect from the management layer to at least make managing VMs easy. The management layer can give names. It can present pictures. It can manage files. It can export a config file + disk image so that it can be imported somewhere else.

Therefore, I don't know what you mean by "learn internals of the tools they use". They don't need to do that, if they use a management layer. All they need to do is to supply everything the management layer may ask of them, and I do not understand why it is too difficult to request a plain config file that the user doesn't even need to understand. They just need to download it along with the disk image.

Quoted 4 lines

But all of that writing once again comes down to this: You are talking about qemu. Dave is talking about something higher in the management layer. Those are different things, and as I said, we first need to find common ground there.

The common ground is that both me and Dave find it useful to store meta-data in the disk image.

Quoted 7 lines

This is exactly why I said "where to store it heavily depends on what we want to store and how we want to use it." As long as we don't know that, all of us are using strawman arguments where some other party suddenly chimes in and says "no, no, no, this is not what I'm talking about". Yes, maybe you aren't, but someone else is.

[...]

Looks like discussion has run its course.

I think it's time for someone motivated enough to send a patch. If enough interested people ack it, we will know it addresses some of their needs.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines

But really, if you create a VM, you need a configuration. Like if you set up a new computer, you need to know what you want. Usually there is no sticky label, but you just have to know and input it manually. Maybe you have a sheet of paper, which I'd call the configuration file.

Most things are figurable-out by the management tools/defaults or are dependent on the whim of the user - we're only trying to stop the user doing things that wont work.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

But what's so bad about an empty screen because the user hasn't read the download description?

Because user just learns to avoid QEMU as being too hard in the future.

So you want appliances, do I understand that correctly? Because that is exactly what Dave doesn't want.

That's policy. I see no need to prevent people from building appliances, though right now I'm not interested in building them myself. We there's a mechanism both kinds of people can use, then great.

Quoted 25 lines

Furthermore, another case of "qemu is too hard to use". I will not argue against you there, because that may very well be true, but I will once again say that I was of the impression that we had management layers to handle that complexity.

Quoted 10 lines
Quoted 8 lines
Quoted 3 lines

Simpler example; what stops you trying to put the PPC qcow image into your x86 VM system - nothing that I know of. I just want to stop the users shooting themselves in the foot.

They haven't shot themselves in the foot, they've just wasted a bit of their time, which could've been avoided by reading before clicking.

[...]

Software developers are being paid for saving people's time.

Very good point, but I did say something like this before: I do not oppose appliances whatsoever. In fact, it seems like a nice thing to have.

But, here's the deal: I do not think putting that data into qcow2 to be the best solution. Furthermore, I have things to do that I consider more important than developing an appliance solution. Therefore, it's not like I'm sitting around doing nothing when I could be developing a solution to this issue here.

Quoted 6 lines

I kept saying that I consider all of this an inconvenience. Yes, it would be nice to have. But I have things on my to do list that are hard feature requests, things that people really do need. We all have. We all need to decide how we can use our own time as efficiently as possible. And I do not think that developing an appliance solution would be the best use of my time. (Until my manager disagrees.)

As long as you don't start sending nacks on the basis that it's also not the best use of other's time, I don't mind.

Quoted 87 lines
Quoted 77 lines
Quoted 77 lines
Quoted 52 lines
Quoted 45 lines
Quoted 33 lines
Quoted 33 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines

--------------------------------------------------------------

Some reasoning:
a) I've avoided the problem of when QEMU interprets the value by ignoring it and giving it to management layers at the point of VM import.

Yes, but in the process you've made it completely opaque to qemu, basically, which doesn't really make it better for me. Not that qemu-specific information in qcow2 files would be what I want, but, well.

But it does solve technical issues, I concede that.

Quoted 3 lines

b) I hate JSON, but there again nailing down a fixed format seems easiest and it makes the job of QCOW easy - a single string.

Quoted 7 lines
Quoted 3 lines

Not really. The string can be rather long, so you probably don't want to store it in the image header, and thus it's just a binary blob from qcow2's perspective, essentially.

Yes, but it's a single blob - I'm not asking for multiple keyed blobs or the ability to update individual blobs; just one blob that I can replace.

OK, you aren't, but others seem to be.

Or, well, you call it a single blob. But actually the current ideas seem to be to store a rather large configuration tree with binary data in that blob, so to me personally there is absolutely no functional difference to just storing a tar file in that blob.

Quoted 8 lines
Quoted 3 lines

So correct me if I'm wrong, but to me it appears that you effectively want to store a filesystem in qcow2.[1] Well, that's better than making qcow2 the filesystem, but it still appears just the wrong way around to me.

It's different in the sense that what we end up with is still a qcow2; anything that just handles qcow2's and can pass them through doesn't need to do anything different; users don't need to do anything different. No one has to pack/unpack the file.

Packing/unpacking is a strawman because I'm doing my best to give proposals that completely avoid that.

Quoted 6 lines

Users do need to do something different, because users do need to realize that today there is no way to store VM configuration and disk data in a single file. So if they already start VMs just based on a disk, then they are assuming behavior we do not have and that I'd call naive. But that is a strawman from my side, sorry. Keeping naive users happy is probably OK.

Quoted 3 lines

Remember this all works fine now and has done for many years; it's the addition of q35 that breaks that assumption.
The users can already blidly pick up the qcow2 image and stuff it in

Which probably was blind luck already. And if it wasn't, that means they knew the defaults are what they want. So now they'd know they aren't and they have to offer a config file along with the disk image.

Quoted 1 line

and it all works; all I want is for that to keep working.

And all I say is that it's not unreasonable to expect users to realize that a VM is more than a disk image, just like a computer is more than a disk drive; and that handling two files really is not the end of the world.

(And neither is wasting someone's time because they can't read.)

Firstly, I agree it's a nice thing to have, but it's not worth it if we don't come up with clear rules on how to prevent developing a full appliance format.

Or maybe we want that (because I still believe that you can always come up with obscure options without which the VM won't boot in your specific case), but then this is beyond just storing a tiny bit of data in a qcow2 image.

Quoted 4 lines
Quoted 1 line

[...]

Either we'll add more and more data later or we won't. Why worry about it from the start? We'll never get anywhere if we do.

That is not a very good argument. Adding things always means having to support them later. It does make a lot of sense to worry about this burden before starting, and thus trying to find the best possible solution for the future, not the easiest hack for now.

Quoted 9 lines

And as I've said multiple times now, but I can't repeat myself often enough, I think it would be most efficient if we worried about what we want to store first, before we worry about where to store it. I believe that once we have a hard requirement on what we want to store and how to use it (that most people agree on), we will have a set of constraints on how we can represent that data and where it needs to be stored, and this will give us a simple yes or no to the question whether the data needs to be stored in qcow2, or whether there is any better way (or whether it can be stored in qcow2, but need not be).

Well the subject says it, does it not? We want to store machine data there.

Quoted 53 lines
Quoted 44 lines
Quoted 44 lines
Quoted 36 lines
Quoted 36 lines
Quoted 35 lines
Quoted 23 lines

[1] Yes, I know that the guest disk already contains an FS. :-P

Quoted 21 lines
Quoted 20 lines
Quoted 11 lines

(I would suggest in layer2 that the keys are sorted, but that's a pain to do in some json creators)
c) Forcing the registry of keys might avoid silly duplication. We can but hope.
d) I've not said it's a libvirt XML file since that seems a bit prescriptive.

Some initial suggested keys:

   "qemu.machine-types": [ "q35", "i440fx" ]
   "qemu.min-ram-MB": 1024

I still don't understand why you'd want to put the configuration into qcow2 instead of the other way around.

Or why you'd want to use a single file at all, because as this whole thread shows, a disk image alone is clearly not sufficient to describe a VM.

(Or it may be in simple cases, but then that's because you don't need any configuration.)

Quoted 8 lines
Quoted 1 line

Because it avoids the unpacking associated with archives.

I'm not talking about unpacking. I'm talking about a potentially new format which allows accessing the qcow2 file in-place. It would probably be trivial to write a block driver to allow this.

(And as I wrote in my response to Michal, I suspect that tar could actually allow this, even though it would probably not be the ideal format.)

As above, I don't think this is trivial; you have to change all the layers; lets say it was a tar; you'd have to somehow know that you're importing one of these special tars,

Quoted 5 lines
Quoted 2 lines

Which is trivial because it's just "Hey, look, it's a tar with that description file".

Trivial? It's taking 100+ mails to add a tag to a qcow2 file! Can you imagine what it takes to change libvirt, openstack, ovirt and the rest?

:-)

Quoted 8 lines
Quoted 3 lines

The implementation is trivial is what I meant, just like the implementation would be rather simple for qcow2 to store a binary blob and completely ignore it.

Old QEMU can't handle tar files. You need to unpack them, then figure out that there are two files in the tar, one is just for new qemu versions, one is portable. At which point you need to go figure out what is your QEMU version.

Quoted 4 lines

And old qemu versions will just give you a blank screen for a qcow2 file with required non-default options.

Max

Compatiblity is not worthless simply because we do not have time travel.

Signature · 1 line
MST
#93 lore raw
In reply to Laszlo Ersek
Quoted 34 lines · * Laszlo Ersek ([email protected]) wrote:
Quoted 15 lines · Andrea Bolognani
Quoted 6 lines · Daniel P. Berrangé
Quoted 4 lines · Richard W.M. Jones

Another problem which Laszlo mentioned is the varstore isn't portable between UEFI implementations, or if the UEFI is compiled with different options. You can even imagine shipping multiple varstores(!) which argues for a tar-like format.

Quoted 7 lines

Could we perhaps imagine shipping the actual UEFI bios, rather than only the varstore. The bios blob runs in guest context, so there shouldn't be able security concerns from hosting vendors with running user provided bios. Mostly its a matter of confidence that the interface between bios & qemu is stable which feels easier than assuming varstore vs different bios is portable.

Quoted 3 lines

That sounds sensible, and further reinforces the idea that we need way more than a single string baked into the qcow2 file.

Sorry for arriving late (thanks Rich for the Fwd).

The contents of the non-volatile UEFI variables should be considered part of (permanent) guest state, such as disk contents. Therefore I'd argue for bundling the varstore file with the disk image(s).

In turn, the best way to ensure comaptibility between varstore and firmware binary is to just bundle the firmware binary as well. It's generally not large (x86) or if it is, it compresses extremely well (aarch64). For extra politeness, image providers can bundle a text file with their firmware build options (like a kernel config), possibly even a JSON document conforming to the new firmware schema (qemu commit 3a0adfc9bfcf), but that's not a hard requirement I guess.

Quoted 2 lines

If such a VM is to be migrated between hosts, I'd expect the host admin to take care of installing the fw binary on all eligible hosts.

There's no way they can do that if they're just importing VMs from templates that include the image; who is going to keep track of which BIOSs are needed where?

Dave

Quoted 31 lines

Regarding compat between QEMU and firmware binary, I see three cases:

(1) Static requirements presented by the firmware for the QEMU configuration. (Such as -D SMM_REQUIRE.) With the domain configuration captured one way or another alongside the disk image anyway, this should not be a problem.

(2) New firmware launched on old QEMU. The firmware generally detects or negotiates features with QEMU, so this should be safe.

(Discounting firmware regressions, of course -- for example, search
<https://www.mail-archive.com/[email protected]/msg471901.html> for the string "I messed up".)

(3) Old firmware launched on new QEMU. This scenario has given us a lot more grief than (2), but I think for the appliance distribution use case, it can be folded into case (1) above -- specify the machine type too in the domain config, and that should be compatible with the old firmware.

(The handling of (3) is not uniform between upstream QEMU and various downstreams. For example, consider
<https://bugs.launchpad.net/qemu/+bug/1715700>. This was a latent bug in OVMF that got exposed by a new QEMU (due to a valid QEMU change), even when using old machine types. The upstream solution was to fix edk2 and stick with QEMU as-was (although the agreement around that hadn't been universal). Conversely, one downstream solution was to restrict the otherwise valid QEMU change to new machine types
<https://bugzilla.redhat.com/show_bug.cgi?id=1489800#c5>.)

Quoted 8 lines

All in all I agree with Daniel's proposal; it seems to be the most robust one.

And, I too recall that, under AMD SEV, users will be supposed to, or allowed to, provide their own firmware binaries.

Thanks!
Laszlo

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#94 lore raw
Quoted 35 lines · Dr. David Alan Gilbert
Quoted 34 lines · * Laszlo Ersek ([email protected]) wrote:
Quoted 15 lines · Andrea Bolognani
Quoted 6 lines · Daniel P. Berrangé
Quoted 4 lines · Richard W.M. Jones

Another problem which Laszlo mentioned is the varstore isn't portable between UEFI implementations, or if the UEFI is compiled with different options. You can even imagine shipping multiple varstores(!) which argues for a tar-like format.

Quoted 7 lines

Could we perhaps imagine shipping the actual UEFI bios, rather than only the varstore. The bios blob runs in guest context, so there shouldn't be able security concerns from hosting vendors with running user provided bios. Mostly its a matter of confidence that the interface between bios & qemu is stable which feels easier than assuming varstore vs different bios is portable.

Quoted 3 lines

That sounds sensible, and further reinforces the idea that we need way more than a single string baked into the qcow2 file.

Sorry for arriving late (thanks Rich for the Fwd).

The contents of the non-volatile UEFI variables should be considered part of (permanent) guest state, such as disk contents. Therefore I'd argue for bundling the varstore file with the disk image(s).

In turn, the best way to ensure comaptibility between varstore and firmware binary is to just bundle the firmware binary as well. It's generally not large (x86) or if it is, it compresses extremely well (aarch64). For extra politeness, image providers can bundle a text file with their firmware build options (like a kernel config), possibly even a JSON document conforming to the new firmware schema (qemu commit 3a0adfc9bfcf), but that's not a hard requirement I guess.

Quoted 6 lines
Quoted 2 lines

If such a VM is to be migrated between hosts, I'd expect the host admin to take care of installing the fw binary on all eligible hosts.

There's no way they can do that if they're just importing VMs from templates that include the image; who is going to keep track of which BIOSs are needed where?

It isn't that unusual a requirement. When Openstack deploys a VM, it has the user provided image as a base file, and then creates qcow2 overlay. If the VM is cold migrated (ie not running) to another host, OpenStack has to make sure the same base file gets copied across to the new host so that the overlay still works. Copying the BIOS file and vars state across at the same time is no more difficult than what its already doing.

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 :|
#95 lore raw
Quoted 43 lines · * Daniel P. Berrangé ([email protected]) wrote:
Quoted 35 lines · Dr. David Alan Gilbert
Quoted 34 lines · * Laszlo Ersek ([email protected]) wrote:
Quoted 15 lines · Andrea Bolognani
Quoted 6 lines · Daniel P. Berrangé
Quoted 4 lines · Richard W.M. Jones

Another problem which Laszlo mentioned is the varstore isn't portable between UEFI implementations, or if the UEFI is compiled with different options. You can even imagine shipping multiple varstores(!) which argues for a tar-like format.

Quoted 7 lines

Could we perhaps imagine shipping the actual UEFI bios, rather than only the varstore. The bios blob runs in guest context, so there shouldn't be able security concerns from hosting vendors with running user provided bios. Mostly its a matter of confidence that the interface between bios & qemu is stable which feels easier than assuming varstore vs different bios is portable.

Quoted 3 lines

That sounds sensible, and further reinforces the idea that we need way more than a single string baked into the qcow2 file.

Sorry for arriving late (thanks Rich for the Fwd).

The contents of the non-volatile UEFI variables should be considered part of (permanent) guest state, such as disk contents. Therefore I'd argue for bundling the varstore file with the disk image(s).

In turn, the best way to ensure comaptibility between varstore and firmware binary is to just bundle the firmware binary as well. It's generally not large (x86) or if it is, it compresses extremely well (aarch64). For extra politeness, image providers can bundle a text file with their firmware build options (like a kernel config), possibly even a JSON document conforming to the new firmware schema (qemu commit 3a0adfc9bfcf), but that's not a hard requirement I guess.

Quoted 6 lines
Quoted 2 lines

If such a VM is to be migrated between hosts, I'd expect the host admin to take care of installing the fw binary on all eligible hosts.

There's no way they can do that if they're just importing VMs from templates that include the image; who is going to keep track of which BIOSs are needed where?

Quoted 7 lines

It isn't that unusual a requirement. When Openstack deploys a VM, it has the user provided image as a base file, and then creates qcow2 overlay. If the VM is cold migrated (ie not running) to another host, OpenStack has to make sure the same base file gets copied across to the new host so that the overlay still works. Copying the BIOS file and vars state across at the same time is no more difficult than what its already doing.

I'm kind of OK with management layers doing it; but Laszlo was suggesting it was an admins problem; if we can make it something manageable by higher levels that's OK.
(Although I'm still concerned that making images with a UEFI image in that's portable is still not going to work).

Dave

Quoted 6 lines

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 :|

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK