mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
Add generic drive hotplugging
The monitor command for hotplugging is in i386 specific code. This is just plain wrong, as S390 just learned how to do hotplugging too and needs to get drives for that. So let's add a generic copy to generic code that handles drive_add in a way that doesn't have pci dependencies. All pci specific code can then be handled in a pci specific function. Signed-off-by: Alexander Graf <agraf@suse.de> --- v1 -> v2: - align generic drive_add to pci specific one - rework to split between generic and pci code v2 -> v3: - remove comment
This commit is contained in:
parent
963d83c854
commit
dd97aa8adc
3 changed files with 56 additions and 21 deletions
|
@ -104,24 +104,13 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void drive_hot_add(Monitor *mon, const QDict *qdict)
|
||||
int pci_drive_hot_add(Monitor *mon, const QDict *qdict,
|
||||
DriveInfo *dinfo, int type)
|
||||
{
|
||||
int dom, pci_bus;
|
||||
unsigned slot;
|
||||
int type;
|
||||
PCIDevice *dev;
|
||||
DriveInfo *dinfo = NULL;
|
||||
const char *pci_addr = qdict_get_str(qdict, "pci_addr");
|
||||
const char *opts = qdict_get_str(qdict, "opts");
|
||||
|
||||
dinfo = add_init_drive(opts);
|
||||
if (!dinfo)
|
||||
goto err;
|
||||
if (dinfo->devaddr) {
|
||||
monitor_printf(mon, "Parameter addr not supported\n");
|
||||
goto err;
|
||||
}
|
||||
type = dinfo->type;
|
||||
|
||||
switch (type) {
|
||||
case IF_SCSI:
|
||||
|
@ -138,19 +127,14 @@ void drive_hot_add(Monitor *mon, const QDict *qdict)
|
|||
goto err;
|
||||
}
|
||||
break;
|
||||
case IF_NONE:
|
||||
monitor_printf(mon, "OK\n");
|
||||
break;
|
||||
default:
|
||||
monitor_printf(mon, "Can't hot-add drive to type %d\n", type);
|
||||
goto err;
|
||||
}
|
||||
return;
|
||||
|
||||
return 0;
|
||||
err:
|
||||
if (dinfo)
|
||||
drive_put_ref(dinfo);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue