mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: Automatic SCSI controller creation in SCSI disk hotplug broken
When a SCSI disk is hotplugged to a domain that does not have the required
SCSI controller already defined and loaded the following internal error occurs
error: Failed to attach device from scsi_disk.xml
error: internal error: Could not find scsi controller with index 0 required for device
Commit 0260506c
added in method qemuBuildDriveDevStr a lookup of the controller
alias. The internal error occurs because in method qemuDomainAttachSCSIDisk
the automatic creation of the potentially missing SCSI controller occurs after
calling qemuBuildDriveDevStr.
This patch reverses the calling sequence.
Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com>
This commit is contained in:
parent
45c7b9e636
commit
105794cd43
@ -607,16 +607,10 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
|
||||
goto error;
|
||||
if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->qemuCaps)))
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
|
||||
goto error;
|
||||
|
||||
/* Let's make sure our disk has a controller defined and loaded
|
||||
* before trying add the disk. The controller the disk is going
|
||||
* to use must exist before a qemu command line string is generated.
|
||||
*/
|
||||
for (i = 0; i <= disk->info.addr.drive.controller; i++) {
|
||||
cont = qemuDomainFindOrCreateSCSIDiskController(driver, vm, i);
|
||||
if (!cont)
|
||||
@ -628,6 +622,16 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn,
|
||||
and hence the above loop must iterate at least once. */
|
||||
sa_assert(cont);
|
||||
|
||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
|
||||
goto error;
|
||||
if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->qemuCaps)))
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
|
||||
goto error;
|
||||
|
||||
if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0)
|
||||
goto error;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user