1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemu: Introduce qemuBuildIOThreadCommandLine

Add new function to manage adding the IOThread '-object' to the command
line removing that task from the mainline qemuBuildCommandLine

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2016-02-17 16:27:30 -05:00
parent e0dd78c9b2
commit 70681e3502

View File

@ -5346,6 +5346,37 @@ qemuBuildMemCommandLine(virCommandPtr cmd,
} }
static int
qemuBuildIOThreadCommandLine(virCommandPtr cmd,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{
size_t i;
if (def->niothreadids == 0)
return 0;
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("IOThreads not supported for this QEMU"));
return -1;
}
/* Create iothread objects using the defined iothreadids list
* and the defined id and name from the list. These may be used
* by a disk definition which will associate to an iothread by
* supplying a value of an id from the list
*/
for (i = 0; i < def->niothreadids; i++) {
virCommandAddArg(cmd, "-object");
virCommandAddArgFormat(cmd, "iothread,id=iothread%u",
def->iothreadids[i]->iothread_id);
}
return 0;
}
static int static int
qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
virDomainDefPtr def, virDomainDefPtr def,
@ -6893,24 +6924,8 @@ qemuBuildCommandLine(virConnectPtr conn,
if (qemuBuildSmpCommandLine(cmd, def, qemuCaps) < 0) if (qemuBuildSmpCommandLine(cmd, def, qemuCaps) < 0)
goto error; goto error;
if (def->niothreadids) { if (qemuBuildIOThreadCommandLine(cmd, def, qemuCaps) < 0)
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("IOThreads not supported for this QEMU"));
goto error; goto error;
}
/* Create iothread objects using the defined iothreadids list
* and the defined id and name from the list. These may be used
* by a disk definition which will associate to an iothread by
* supplying a value of an id from the list
*/
for (i = 0; i < def->niothreadids; i++) {
virCommandAddArg(cmd, "-object");
virCommandAddArgFormat(cmd, "iothread,id=iothread%u",
def->iothreadids[i]->iothread_id);
}
}
if (virDomainNumaGetNodeCount(def->numa) && if (virDomainNumaGetNodeCount(def->numa) &&
qemuBuildNumaArgStr(cfg, def, cmd, qemuCaps, nodeset) < 0) qemuBuildNumaArgStr(cfg, def, cmd, qemuCaps, nodeset) < 0)