Skip to contentSkip to conversation

hw/core: Allow setting 'virtio-blk-device.scsi' property on OSX host

PATCH Applied Philippe Mathieu-Daudé 3 participants 3 messages Feb 7, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/core: Allow setting 'virtio-blk-device.scsi' property on OSX host

Commit ed65fd1a2750 ("virtio-blk: switch off scsi-passthrough by default") changed the default value of the 'scsi' property of virtio-blk, which is only available on Linux hosts. It also added an unconditional compat entry for 2.4 or earlier machines.

Trying to set this property on a pre-2.5 machine on OSX, we get:

Unexpected error in object_property_find() at qom/object.c:1201:
qemu-system-x86_64: -device virtio-blk-pci,id=scsi0,drive=drive0: can't apply global virtio-blk-device.scsi=true: Property '.scsi' not found

Fix this error by marking the property optional.

Fixes ed65fd1a27 ("virtio-blk: switch off scsi-passthrough by default")

---
v2: Reworded description (Cornelia)

Extracted from testing series:
https://www.mail-archive.com/[email protected]/msg675074.html

---
 hw/core/machine.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/core/machine.c +2 -1
index 3e288bfceb..d8e30e4895 100644
@@ -148,7 +148,8 @@ GlobalProperty hw_compat_2_5[] = {
 const size_t hw_compat_2_5_len = G_N_ELEMENTS(hw_compat_2_5);
 
 GlobalProperty hw_compat_2_4[] = {
-    { "virtio-blk-device", "scsi", "true" },
+    /* Optional because the 'scsi' property is Linux-only */
+    { "virtio-blk-device", "scsi", "true", .optional = true },
     { "e1000", "extra_mac_registers", "off" },
     { "virtio-pci", "x-disable-pcie", "on" },
     { "virtio-pci", "migrate-extra", "off" },
Signature · 1 line
2.21.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Philippe Mathieu-Daudé

Commit ed65fd1a2750 ("virtio-blk: switch off scsi-passthrough by default") changed the default value of the 'scsi' property of virtio-blk, which is only available on Linux hosts. It also added an unconditional compat entry for 2.4 or earlier machines.

Trying to set this property on a pre-2.5 machine on OSX, we get:

Unexpected error in object_property_find() at qom/object.c:1201:
qemu-system-x86_64: -device virtio-blk-pci,id=scsi0,drive=drive0: can't apply global virtio-blk-device.scsi=true: Property '.scsi' not found

Quoted 6 lines

Fix this error by marking the property optional.

Fixes ed65fd1a27 ("virtio-blk: switch off scsi-passthrough by default")

Stefan I think this makes sense in your tree same as the original patch it's fixing. Right?

Quoted 25 lines

---
v2: Reworded description (Cornelia)

Extracted from testing series:
https://www.mail-archive.com/[email protected]/msg675074.html

---
 hw/core/machine.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/core/machine.c +2 -1
index 3e288bfceb..d8e30e4895 100644
@@ -148,7 +148,8 @@ GlobalProperty hw_compat_2_5[] = {
 const size_t hw_compat_2_5_len = G_N_ELEMENTS(hw_compat_2_5);
 
 GlobalProperty hw_compat_2_4[] = {
-    { "virtio-blk-device", "scsi", "true" },
+    /* Optional because the 'scsi' property is Linux-only */
+    { "virtio-blk-device", "scsi", "true", .optional = true },
     { "e1000", "extra_mac_registers", "off" },
     { "virtio-pci", "x-disable-pcie", "on" },
     { "virtio-pci", "migrate-extra", "off" },
Signature · 1 line
2.21.1
#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 16 lines · Philippe Mathieu-Daudé

Commit ed65fd1a2750 ("virtio-blk: switch off scsi-passthrough by default") changed the default value of the 'scsi' property of virtio-blk, which is only available on Linux hosts. It also added an unconditional compat entry for 2.4 or earlier machines.

Trying to set this property on a pre-2.5 machine on OSX, we get:

Unexpected error in object_property_find() at qom/object.c:1201:
qemu-system-x86_64: -device virtio-blk-pci,id=scsi0,drive=drive0: can't apply global virtio-blk-device.scsi=true: Property '.scsi' not found

Fix this error by marking the property optional.

Fixes ed65fd1a27 ("virtio-blk: switch off scsi-passthrough by default")
Quoted 8 lines

---
v2: Reworded description (Cornelia)

Extracted from testing series:
https://www.mail-archive.com/[email protected]/msg675074.html

---
 hw/core/machine.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan