提交 7e3dd506 编写于 作者: P Pavel Hrdina

qemu_process: move capabilities check for iothreads

Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 caf66e01
...@@ -2586,23 +2586,11 @@ qemuBuildUSBControllerDevStr(virDomainControllerDefPtr def, ...@@ -2586,23 +2586,11 @@ qemuBuildUSBControllerDevStr(virDomainControllerDefPtr def,
*/ */
static bool static bool
qemuCheckSCSIControllerIOThreads(const virDomainDef *domainDef, qemuCheckSCSIControllerIOThreads(const virDomainDef *domainDef,
virDomainControllerDefPtr def, virDomainControllerDefPtr def)
virQEMUCapsPtr qemuCaps)
{ {
if (!def->iothread) if (!def->iothread)
return true; 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) { if (def->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("IOThreads only supported for virtio-scsi " _("IOThreads only supported for virtio-scsi "
...@@ -2681,8 +2669,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, ...@@ -2681,8 +2669,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
virBufferAddLit(&buf, "virtio-scsi-ccw"); virBufferAddLit(&buf, "virtio-scsi-ccw");
if (def->iothread) { if (def->iothread) {
if (!qemuCheckSCSIControllerIOThreads(domainDef, if (!qemuCheckSCSIControllerIOThreads(domainDef, def))
def, qemuCaps))
goto error; goto error;
virBufferAsprintf(&buf, ",iothread=iothread%u", virBufferAsprintf(&buf, ",iothread=iothread%u",
def->iothread); def->iothread);
...@@ -2696,8 +2683,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, ...@@ -2696,8 +2683,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
} else { } else {
virBufferAddLit(&buf, "virtio-scsi-pci"); virBufferAddLit(&buf, "virtio-scsi-pci");
if (def->iothread) { if (def->iothread) {
if (!qemuCheckSCSIControllerIOThreads(domainDef, if (!qemuCheckSCSIControllerIOThreads(domainDef, def))
def, qemuCaps))
goto error; goto error;
virBufferAsprintf(&buf, ",iothread=iothread%u", virBufferAsprintf(&buf, ",iothread=iothread%u",
def->iothread); def->iothread);
...@@ -7389,20 +7375,13 @@ qemuBuildMemCommandLine(virCommandPtr cmd, ...@@ -7389,20 +7375,13 @@ qemuBuildMemCommandLine(virCommandPtr cmd,
static int static int
qemuBuildIOThreadCommandLine(virCommandPtr cmd, qemuBuildIOThreadCommandLine(virCommandPtr cmd,
const virDomainDef *def, const virDomainDef *def)
virQEMUCapsPtr qemuCaps)
{ {
size_t i; size_t i;
if (def->niothreadids == 0) if (def->niothreadids == 0)
return 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 /* Create iothread objects using the defined iothreadids list
* and the defined id and name from the list. These may be used * and the defined id and name from the list. These may be used
* by a disk definition which will associate to an iothread by * by a disk definition which will associate to an iothread by
...@@ -9715,7 +9694,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, ...@@ -9715,7 +9694,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
if (qemuBuildSmpCommandLine(cmd, def) < 0) if (qemuBuildSmpCommandLine(cmd, def) < 0)
goto error; goto error;
if (qemuBuildIOThreadCommandLine(cmd, def, qemuCaps) < 0) if (qemuBuildIOThreadCommandLine(cmd, def) < 0)
goto error; goto error;
if (virDomainNumaGetNodeCount(def->numa) && if (virDomainNumaGetNodeCount(def->numa) &&
......
...@@ -4584,6 +4584,37 @@ qemuProcessStartValidateVideo(virDomainObjPtr vm, ...@@ -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 static int
qemuProcessStartValidateXML(virQEMUDriverPtr driver, qemuProcessStartValidateXML(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
...@@ -4660,6 +4691,9 @@ qemuProcessStartValidate(virQEMUDriverPtr driver, ...@@ -4660,6 +4691,9 @@ qemuProcessStartValidate(virQEMUDriverPtr driver,
if (qemuProcessStartValidateVideo(vm, qemuCaps) < 0) if (qemuProcessStartValidateVideo(vm, qemuCaps) < 0)
return -1; return -1;
if (qemuProcessStartValidateIOThreads(vm, qemuCaps) < 0)
return -1;
VIR_DEBUG("Checking for any possible (non-fatal) issues"); VIR_DEBUG("Checking for any possible (non-fatal) issues");
qemuProcessStartWarnShmem(vm); qemuProcessStartWarnShmem(vm);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册