hotplug: fix "pci_add storage if=scsi"
PATCH 1/1 hotplug: fix "pci_add storage if=scsi"
Explicitly add the drive to the bus of the newly created scsi adapter instead of hoping that scsi_bus_legacy_handle_cmdline() picks it up correctly.
--- hw/lsi53c895a.c | 4 +++- hw/pci-hotplug.c | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-)
hw/lsi53c895a.c +3 -1
@@ -2178,7 +2178,9 @@ static int lsi_scsi_init(PCIDevice *dev)lsi_soft_reset (s);scsi_bus_new (&s->bus, &dev->qdev,1 ,LSI_MAX_DEVS , lsi_command_complete); -scsi_bus_legacy_handle_cmdline (&s->bus); +if (!dev->qdev.hotplugged) { +scsi_bus_legacy_handle_cmdline (&s->bus); + }register_savevm ("lsiscsi" ,-1 ,0 , lsi_scsi_save, lsi_scsi_load, s);return 0 ; }
hw/pci-hotplug.c +13 -2
@@ -159,7 +159,18 @@ 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) { +BusState *scsibus =QLIST_FIRST (&dev->qdev.child_bus); +scsi_bus_legacy_add_drive (DO_UPCAST (SCSIBus, qbus, scsibus), + dinfo, dinfo->unit); + }break ;case IF_VIRTIO :if (!dinfo) {
@@ -168,12 +179,12 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon, } dev =pci_create (bus, devfn,"virtio-blk-pci" );qdev_prop_set_drive (&dev->qdev,"drive" , dinfo); +if (qdev_init (&dev->qdev) <0 ) + dev =NULL ;break ;default : dev =NULL ; } -if (!dev ||qdev_init (&dev->qdev) <0 ) -return NULL ;return dev; }
Signature · 1 line
1.6.2.5
Quoted 6 lines · Gerd Hoffmann
Explicitly add the drive to the bus of the newly created scsi adapter instead of hoping that
scsi_bus_legacy_handle_cmdline()picks it up correctly.Signed-off-by Gerd Hoffmann <[email protected]>
I think that this is also broken in stable-0.11. The backport seems non-trivial. Could you take a look?
Regards,
Anthony Liguori
Quoted 10 lines · Anthony Liguori
Quoted 6 lines · Gerd Hoffmann
Explicitly add the drive to the bus of the newly created scsi adapter instead of hoping that
scsi_bus_legacy_handle_cmdline()picks it up correctly.Signed-off-by Gerd Hoffmann <[email protected]>I think that this is also broken in stable-0.11. The backport seems non-trivial. Could you take a look?
Definitely broken in stable-0.11.
I took a look at backporting this patch, but it seems that (at least) in stable-0.11:
* scsi_bus_legacy_handle_cmdline() doesn't exist
* scsi_bus_new() syntax may have changed (?)
* pci_create() syntax may have changed (?)
I'll gladly test and ack a backport ;-)
Thanks,
:-Dustin