mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-09 10:13:13 +00:00
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>
This commit is contained in:
parent
e8ee28fb3e
commit
5b684b5a56
@ -2178,7 +2178,9 @@ static int lsi_scsi_init(PCIDevice *dev)
|
|||||||
lsi_soft_reset(s);
|
lsi_soft_reset(s);
|
||||||
|
|
||||||
scsi_bus_new(&s->bus, &dev->qdev, 1, LSI_MAX_DEVS, lsi_command_complete);
|
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);
|
register_savevm("lsiscsi", -1, 0, lsi_scsi_save, lsi_scsi_load, s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,18 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case IF_SCSI:
|
case IF_SCSI:
|
||||||
|
if (!dinfo) {
|
||||||
|
monitor_printf(mon, "scsi requires a backing file/device.\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
dev = pci_create(bus, devfn, "lsi53c895a");
|
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;
|
break;
|
||||||
case IF_VIRTIO:
|
case IF_VIRTIO:
|
||||||
if (!dinfo) {
|
if (!dinfo) {
|
||||||
@ -168,12 +179,12 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
|
|||||||
}
|
}
|
||||||
dev = pci_create(bus, devfn, "virtio-blk-pci");
|
dev = pci_create(bus, devfn, "virtio-blk-pci");
|
||||||
qdev_prop_set_drive(&dev->qdev, "drive", dinfo);
|
qdev_prop_set_drive(&dev->qdev, "drive", dinfo);
|
||||||
|
if (qdev_init(&dev->qdev) < 0)
|
||||||
|
dev = NULL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev = NULL;
|
dev = NULL;
|
||||||
}
|
}
|
||||||
if (!dev || qdev_init(&dev->qdev) < 0)
|
|
||||||
return NULL;
|
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user