mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
qemu_process: move capabilities check for iothreads
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
caf66e0196
commit
7e3dd50650
@ -2586,23 +2586,11 @@ qemuBuildUSBControllerDevStr(virDomainControllerDefPtr def,
|
||||
*/
|
||||
static bool
|
||||
qemuCheckSCSIControllerIOThreads(const virDomainDef *domainDef,
|
||||
virDomainControllerDefPtr def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
virDomainControllerDefPtr def)
|
||||
{
|
||||
if (!def->iothread)
|
||||
return true;
|
||||
|
||||
/* By this time QEMU_CAPS_OBJECT_IOTHREAD was already checked.
|
||||
* We just need to check if the QEMU_CAPS_VIRTIO_SCSI_IOTHREAD
|
||||
* capability is set.
|
||||
*/
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI_IOTHREAD)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("IOThreads for virtio-scsi not supported for "
|
||||
"this QEMU"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (def->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("IOThreads only supported for virtio-scsi "
|
||||
@ -2681,8 +2669,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
|
||||
if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
|
||||
virBufferAddLit(&buf, "virtio-scsi-ccw");
|
||||
if (def->iothread) {
|
||||
if (!qemuCheckSCSIControllerIOThreads(domainDef,
|
||||
def, qemuCaps))
|
||||
if (!qemuCheckSCSIControllerIOThreads(domainDef, def))
|
||||
goto error;
|
||||
virBufferAsprintf(&buf, ",iothread=iothread%u",
|
||||
def->iothread);
|
||||
@ -2696,8 +2683,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
|
||||
} else {
|
||||
virBufferAddLit(&buf, "virtio-scsi-pci");
|
||||
if (def->iothread) {
|
||||
if (!qemuCheckSCSIControllerIOThreads(domainDef,
|
||||
def, qemuCaps))
|
||||
if (!qemuCheckSCSIControllerIOThreads(domainDef, def))
|
||||
goto error;
|
||||
virBufferAsprintf(&buf, ",iothread=iothread%u",
|
||||
def->iothread);
|
||||
@ -7389,20 +7375,13 @@ qemuBuildMemCommandLine(virCommandPtr cmd,
|
||||
|
||||
static int
|
||||
qemuBuildIOThreadCommandLine(virCommandPtr cmd,
|
||||
const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
const virDomainDef *def)
|
||||
{
|
||||
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
|
||||
@ -9715,7 +9694,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
|
||||
if (qemuBuildSmpCommandLine(cmd, def) < 0)
|
||||
goto error;
|
||||
|
||||
if (qemuBuildIOThreadCommandLine(cmd, def, qemuCaps) < 0)
|
||||
if (qemuBuildIOThreadCommandLine(cmd, def) < 0)
|
||||
goto error;
|
||||
|
||||
if (virDomainNumaGetNodeCount(def->numa) &&
|
||||
|
@ -4584,6 +4584,37 @@ qemuProcessStartValidateVideo(virDomainObjPtr vm,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuProcessStartValidateIOThreads(virDomainObjPtr vm,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (vm->def->niothreadids > 0 &&
|
||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("IOThreads not supported for this QEMU"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < vm->def->ncontrollers; i++) {
|
||||
virDomainControllerDefPtr cont = vm->def->controllers[i];
|
||||
|
||||
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
|
||||
cont->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI &&
|
||||
cont->iothread > 0 &&
|
||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI_IOTHREAD)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("IOThreads for virtio-scsi not supported for "
|
||||
"this QEMU"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuProcessStartValidateXML(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
@ -4660,6 +4691,9 @@ qemuProcessStartValidate(virQEMUDriverPtr driver,
|
||||
if (qemuProcessStartValidateVideo(vm, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuProcessStartValidateIOThreads(vm, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
VIR_DEBUG("Checking for any possible (non-fatal) issues");
|
||||
|
||||
qemuProcessStartWarnShmem(vm);
|
||||
|
Loading…
x
Reference in New Issue
Block a user