Skip to contentSkip to conversation

Fix backcompat for hotplug of SCSI controllers

PATCH In review Daniel P. Berrange 3 participants 3 messages Dec 7, 2009 – Dec 8, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix backcompat for hotplug of SCSI controllers

SCSI controllers have no trouble existing without any attached disks. This could be achieved with the (legacy) monitor syntax

pci_add pci_addr=auto storage if=scsi

This is now denied with

scsi requires a backing file/device.
failed to add if=scsi

There is no need for this denial and it breaks compatability with existing QEMU usage, so remove the check for presence of a drive.

---
 hw/pci-hotplug.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
hw/pci-hotplug.c +1 -5
index 081d6d1..616435a 100644
@@ -182,14 +182,10 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
 
     switch (type) {
     case IF_SCSI:
-        if (!dinfo) {
-            monitor_printf(mon, "scsi requires a backing file/device.\n");
-            return NULL;
-        }
         dev = pci_create(bus, devfn, "lsi53c895a");
         if (qdev_init(&dev->qdev) < 0)
             dev = NULL;
-        if (dev) {
+        if (dev && dinfo) {
             if (scsi_hot_add(&dev->qdev, dinfo, 0) != 0) {
                 qdev_unplug(&dev->qdev);
                 dev = NULL;
Signature · 1 line
1.6.5.2
#1 lore raw
Quoted 5 lines · Daniel P. Berrange

SCSI controllers have no trouble existing without any attached disks. This could be achieved with the (legacy) monitor syntax

pci_add pci_addr=auto storage if=scsi

Quoted 9 lines

This is now denied with

scsi requires a backing file/device.
failed to add if=scsi

There is no need for this denial and it breaks compatability with existing QEMU usage, so remove the check for presence of a drive.

Gerd, care to comment? This bit of code seems pretty intentional:

commit 5b684b5a56e81f6f88234952fe8ed68010c36e19

Author: Gerd Hoffmann <[email protected]>
Date:   Tue Oct 13 13:59:55 2009 +0200

hotplug: fix "pci_add storage if=scsi"

Quoted 16 lines
---
 hw/pci-hotplug.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
hw/pci-hotplug.c +0 -2
index 081d6d1..616435a 100644
@@ -182,14 +182,10 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
 
     switch (type) {
     case IF_SCSI:
-        if (!dinfo) {
-            monitor_printf(mon, "scsi requires a backing file/device.\n");

hw/pci-hotplug.c static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon, · line 191

Quoted 10 lines
hw/pci-hotplug.c +1 -3
-            return NULL;
-        }
         dev = pci_create(bus, devfn, "lsi53c895a");
         if (qdev_init(&dev->qdev) < 0)
             dev = NULL;
-        if (dev) {
+        if (dev && dinfo) {
             if (scsi_hot_add(&dev->qdev, dinfo, 0) != 0) {
                 qdev_unplug(&dev->qdev);
                 dev = NULL;

Regards,

Anthony Liguori

#2 lore raw
Quoted 8 lines · Anthony Liguori
Quoted 7 lines · Daniel P. Berrange

SCSI controllers have no trouble existing without any attached disks. This could be achieved with the (legacy) monitor syntax

pci_add pci_addr=auto storage if=scsi

This is now denied with

Quoted 8 lines
Quoted 6 lines

scsi requires a backing file/device.
failed to add if=scsi

There is no need for this denial and it breaks compatability with existing QEMU usage, so remove the check for presence of a drive.

Gerd, care to comment? This bit of code seems pretty intentional:

Looks fine to me. If older qemu versions allow creating disk-less scsi adapters this way we should keep that behavior for compatibility reasons.

Quoted 5 lines

commit 5b684b5a56e81f6f88234952fe8ed68010c36e19
Author: Gerd Hoffmann <[email protected]>
Date: Tue Oct 13 13:59:55 2009 +0200

hotplug: fix "pci_add storage if=scsi"

There is no conflict with this bugfix.

cheers,
Gerd