Skip to contentSkip to conversation

libxl: No emulated disk driver for xvdX disk

PATCH Applied Anthony PERARD 7 participants 14 messages Oct 14, 2015 – Oct 27, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: No emulated disk driver for xvdX disk

When a guest configuration list xvdX for its disks, there is no need to provide an emulated driver for the same target.

Such configuration can work with the OVMF firmware, as it supports PV disk.

---
 tools/libxl/libxl_dm.c | 6 ++++++
 1 file changed, 6 insertions(+)
tools/libxl/libxl_dm.c +6 -0
index 71a1a3e..5371f72 100644
@@ -1190,6 +1190,12 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
                     drive = libxl__sprintf
                         (gc, "file=%s,if=scsi,bus=0,unit=%d,format=%s,cache=writeback",
                          pdev_path, disk, format);
+                else if (strncmp(disks[i].vdev, "xvd", 3) == 0)
+                    /*
+                     * Do not add any emulated disk when PV disk are
+                     * explicitly asked for.
+                     */
+                    continue;
                 else if (disk < 6 && b_info->u.hvm.hdtype == LIBXL_HDTYPE_AHCI) {
                     flexarray_vappend(dm_args, "-drive",
                         GCSPRINTF("file=%s,if=none,id=ahcidisk-%d,format=%s,cache=writeback",
Signature · 1 line
Anthony PERARD
Acked-by on v1 1/1
#1 lore raw

Anthony PERARD writes ("[PATCH] libxl: No emulated disk driver for xvdX disk"):

Quoted 5 lines

When a guest configuration list xvdX for its disks, there is no need to provide an emulated driver for the same target.

Such configuration can work with the OVMF firmware, as it supports PV disk.

I have checked this with the docs, and this change makes the libxl behave as documented and as I intended when I wrote the doc.

Ian.

Applied
#2 lore raw
Quoted 9 lines · Ian Jackson

Anthony PERARD writes ("[PATCH] libxl: No emulated disk driver for xvdX disk"):

Quoted 5 lines

When a guest configuration list xvdX for its disks, there is no need to provide an emulated driver for the same target.

Such configuration can work with the OVMF firmware, as it supports PV disk.

Applied.

#3 lore raw
In reply to Ian Jackson
Quoted 11 lines · Ian Jackson

Anthony PERARD writes ("[PATCH] libxl: No emulated disk driver for xvdX disk"):

Quoted 5 lines

When a guest configuration list xvdX for its disks, there is no need to provide an emulated driver for the same target.

Such configuration can work with the OVMF firmware, as it supports PV disk.

I have checked this with the docs, and this change makes the libxl behave as documented and as I intended when I wrote the doc.

This commit prevents a guest from discovering disks that specify xvdX ("disk = [ '/root/virt/fedora.img,raw,xvda,rw' ]", for example).

TBH, I am not sure I understand how this is supposed to work --- how is the guest expected to discover the disk?

-boris

#4 lore raw
In reply to Ian Jackson
Quoted 11 lines · Ian Jackson

Anthony PERARD writes ("[PATCH] libxl: No emulated disk driver for xvdX disk"):

Quoted 5 lines

When a guest configuration list xvdX for its disks, there is no need to provide an emulated driver for the same target.

Such configuration can work with the OVMF firmware, as it supports PV disk.

I have checked this with the docs, and this change makes the libxl behave as documented and as I intended when I wrote the doc.

This commit prevents a guest from seeing disks that specify xvdX ("disk = [ '/root/virt/fedora.img,raw,xvda,rw' ]", for example).

TBH, I am not sure I understand how this is supposed to work --- how is the guest expected to discover the disk?

-boris

#5 lore raw
Quoted 15 lines · Boris Ostrovsky
Quoted 5 lines · Ian Jackson

Anthony PERARD writes ("[PATCH] libxl: No emulated disk driver for xvdX disk"):

Quoted 3 lines

When a guest configuration list xvdX for its disks, there is no need to provide an emulated driver for the same target.

Quoted 7 lines
Quoted 2 lines

Such configuration can work with the OVMF firmware, as it supports PV disk.

I have checked this with the docs, and this change makes the libxl behave as documented and as I intended when I wrote the doc.

Quoted 5 lines

This commit prevents a guest from seeing disks that specify xvdX ("disk = [ '/root/virt/fedora.img,raw,xvda,rw' ]", for example).

TBH, I am not sure I understand how this is supposed to work --- how is the guest expected to discover the disk?

The guest can access xvdX disks via the PV block protocol, or via UEFI firmare using EFI BootServices.

#6 lore raw
Quoted 16 lines · Stefano Stabellini
Quoted 15 lines · Boris Ostrovsky
Quoted 12 lines · Ian Jackson

Anthony PERARD writes ("[PATCH] libxl: No emulated disk driver for xvdX disk"):

Quoted 5 lines

When a guest configuration list xvdX for its disks, there is no need to provide an emulated driver for the same target.

Such configuration can work with the OVMF firmware, as it supports PV disk.

I have checked this with the docs, and this change makes the libxl behave as documented and as I intended when I wrote the doc.

Quoted 8 lines
Quoted 5 lines

This commit prevents a guest from seeing disks that specify xvdX ("disk = [ '/root/virt/fedora.img,raw,xvda,rw' ]", for example).

TBH, I am not sure I understand how this is supposed to work --- how is the guest expected to discover the disk?

The guest can access xvdX disks via the PV block protocol, or via UEFI firmare using EFI BootServices.

But it introduces a sort of regression in some setups -- namely, before you could use exactly the same disk and config file for either a PV or HVM guest, simply adding builder=hvm (either to the file or the command line) to switch between the two.

I'm not sure how many people depend on disk=[...xvda] working on non-OVMF HVM guests, but my current testing setups certainly do.

-George

#7 lore raw

George Dunlap writes ("Re: [Xen-devel] [PATCH] libxl: No emulated disk driver for xvdX disk"):

Quoted 9 lines
Quoted 2 lines · Stefano Stabellini

The guest can access xvdX disks via the PV block protocol, or via UEFI firmare using EFI BootServices.

But it introduces a sort of regression in some setups -- namely, before you could use exactly the same disk and config file for either a PV or HVM guest, simply adding builder=hvm (either to the file or the command line) to switch between the two.

The purpose of the `vdev' in the xl disk specification is to say how the disk should be presented to the guest.

Did you look at docs/misc/vbd-interface.txt ?

If you want something that is accessible via the BIOS etc. in HVM guests, why not use vdev=hda rather than vdev=xvda ?

Ian.

#8 lore raw
Quoted 9 lines · Ian Jackson

George Dunlap writes ("Re: [Xen-devel] [PATCH] libxl: No emulated disk driver for xvdX disk"):

Quoted 8 lines
Quoted 2 lines · Stefano Stabellini

The guest can access xvdX disks via the PV block protocol, or via UEFI firmare using EFI BootServices.

But it introduces a sort of regression in some setups -- namely, before you could use exactly the same disk and config file for either a PV or HVM guest, simply adding builder=hvm (either to the file or the command line) to switch between the two.

Quoted 7 lines

The purpose of the `vdev' in the xl disk specification is to say how the disk should be presented to the guest.

Did you look at docs/misc/vbd-interface.txt ?

If you want something that is accessible via the BIOS etc. in HVM guests, why not use vdev=hda rather than vdev=xvda ?

Yes, but since we've discovered that people do use xvda (and have been doing this for long time --- our test framework has been running for many years configured like that) --- do we want this to suddenly break?

-boris

#9 lore raw

Boris Ostrovsky writes ("Re: [Xen-devel] [PATCH] libxl: No emulated disk driver for xvdX disk"):

Quoted 7 lines · Ian Jackson
Quoted 2 lines

If you want something that is accessible via the BIOS etc. in HVM guests, why not use vdev=hda rather than vdev=xvda ?

Yes, but since we've discovered that people do use xvda (and have been doing this for long time --- our test framework has been running for many years configured like that) --- do we want this to suddenly break?

So you want us to change the spec to match the implementation ? (I haven't looked what happens with trad qemu.)

If we change the spec, how would a user request an xvda with no emulated device ?

Ian.

#13 lore raw
In reply to Ian Jackson
Quoted 11 lines · Ian Jackson

George Dunlap writes ("Re: [Xen-devel] [PATCH] libxl: No emulated disk driver for xvdX disk"):

Quoted 9 lines
Quoted 2 lines · Stefano Stabellini

The guest can access xvdX disks via the PV block protocol, or via UEFI firmare using EFI BootServices.

But it introduces a sort of regression in some setups -- namely, before you could use exactly the same disk and config file for either a PV or HVM guest, simply adding builder=hvm (either to the file or the command line) to switch between the two.

Quoted 7 lines

The purpose of the `vdev' in the xl disk specification is to say how the disk should be presented to the guest.

Did you look at docs/misc/vbd-interface.txt ?

If you want something that is accessible via the BIOS etc. in HVM guests, why not use vdev=hda rather than vdev=xvda ?

If I then take the came config file and remove 'builder="hvm"', will the resulting thing boot as a PV guest?

I understand the idea of saying, "Well, 'vdev=xvda' means a PV disk; you haven't asked for an emulated disk, so you shouldn't expect to get one."
It's all very nice and neat and logical. But:

1. It's been this way for years, and at least many developers' testing systems have come to rely on this behavior. I'd be surprised if this didn't break a lot of users' configurations on upgrade

2. Being able to boot the exact same config file either PV or HVM is a feature that makes sense to have

If both SeaBIOS and OVMF had PV drivers I don't think it would really be an issue; but they don't.

The real issue I guess is that there is "automatic" behavior here that we don't have a flag to control: PV disks get emulated counterparts automatically, and emulated disks get PV counterparts automatically. Would it make sense to have a per-device flag to specify this? mirror=(true|false|auto), where "auto" is the default?

If we can detect whether we're booting with SeaBIOS or OVMF, we can even have "auto" default to "false' for OVMF, and "true" for SeaBIOS (until such time as we have PV drivers in SeaBIOS).

-George

#10 lore raw
In reply to Ian Jackson
Quoted 4 lines · Ian Jackson

Boris Ostrovsky writes ("Re: [Xen-devel] [PATCH] libxl: No emulated disk driver for xvdX disk"):

Quoted 3 lines · Ian Jackson
Quoted 2 lines

If you want something that is accessible via the BIOS etc. in HVM guests, why not use vdev=hda rather than vdev=xvda ?

Quoted 8 lines
Quoted 3 lines

Yes, but since we've discovered that people do use xvda (and have been doing this for long time --- our test framework has been running for many years configured like that) --- do we want this to suddenly break?

So you want us to change the spec to match the implementation ? (I haven't looked what happens with trad qemu.)

If we change the spec, how would a user request an xvda with no emulated device ?

Can we allow specifying xvdX when we know that seabios is going to be used?

-boris

#11 lore raw

George Dunlap writes ("Re: [Xen-devel] [PATCH] libxl: No emulated disk driver for xvdX disk"):

Quoted 2 lines

If I then take the came config file and remove 'builder="hvm"', will the resulting thing boot as a PV guest?

I haven't tried this but I don't see why not.

Quoted 9 lines

The real issue I guess is that there is "automatic" behavior here that we don't have a flag to control: PV disks get emulated counterparts automatically, and emulated disks get PV counterparts automatically. Would it make sense to have a per-device flag to specify this? mirror=(true|false|auto), where "auto" is the default?

If we can detect whether we're booting with SeaBIOS or OVMF, we can even have "auto" default to "false' for OVMF, and "true" for SeaBIOS (until such time as we have PV drivers in SeaBIOS).

I don't think this is helpful.

Ian.

#12 lore raw
Quoted 5 lines · Ian Jackson

George Dunlap writes ("Re: [Xen-devel] [PATCH] libxl: No emulated disk driver for xvdX disk"):

Quoted 2 lines

If I then take the came config file and remove 'builder="hvm"', will the resulting thing boot as a PV guest?

I haven't tried this but I don't see why not.

FWIW it does work.

-George