提交 58d07db9 编写于 作者: M Marc Hartmayer 提交者: Peter Krempa

qemu: hot-plug: Fix broken SCSI disk hot-plug

The commit "qemu: hot-plug: Assume support for -device in
qemuDomainAttachSCSIDisk" dropped the code for the automatic SCSI
controller creation used in SCSI disk hot-plugging. If we are
hot-plugging a SCSI disk to a domain and there is no proper SCSI
controller defined, it results in an "error: internal error: Could not
find scsi controller with index X required for device" error.

For that reason reverting a hunk of the commit
d4d32005.

This patch also adds an extra comment to the code to clarify the
loop.
Reviewed-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: NBjoern Walk <bwalk@linux.vnet.ibm.com>
Signed-off-by: NMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
上级 bb848fee
......@@ -544,6 +544,7 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn,
virDomainObjPtr vm,
virDomainDiskDefPtr disk)
{
size_t i;
qemuDomainObjPrivatePtr priv = vm->privateData;
char *drivestr = NULL;
char *devstr = NULL;
......@@ -561,6 +562,18 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn,
goto error;
}
/* Let's make sure the disk has a controller defined and loaded before
* trying to add it. The controller used by the disk must exist before a
* qemu command line string is generated.
*
* Ensure that the given controller and all controllers with a smaller index
* exist; there must not be any missing index in between.
*/
for (i = 0; i <= disk->info.addr.drive.controller; i++) {
if (!qemuDomainFindOrCreateSCSIDiskController(driver, vm, i))
goto error;
}
if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
goto error;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册