diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2009-10-13 13:59:55 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-10-27 12:28:42 -0500 |
commit | 5b684b5a56e81f6f88234952fe8ed68010c36e19 (patch) | |
tree | b3bc7f3b86f8cce64e83429ec7d28e0687039fe2 /hw/pci-hotplug.c | |
parent | e8ee28fb3e6cc2c4f5ec10d0aec9ff8ae9469e93 (diff) |
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.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/pci-hotplug.c')
-rw-r--r-- | hw/pci-hotplug.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 4673b898ab..4eea60c8dd 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -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; } |