static int
qemuDomainGetIOThreadsMon(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- qemuMonitorIOThreadInfoPtr **iothreads)
+ qemuMonitorIOThreadInfoPtr **iothreads,
+ int *niothreads)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- int niothreads = 0;
+ int ret = -1;
qemuDomainObjEnterMonitor(driver, vm);
- niothreads = qemuMonitorGetIOThreads(priv->mon, iothreads);
- if (qemuDomainObjExitMonitor(driver, vm) < 0 || niothreads < 0)
+ ret = qemuMonitorGetIOThreads(priv->mon, iothreads, niothreads);
+ if (qemuDomainObjExitMonitor(driver, vm) < 0)
return -1;
- return niothreads;
+ return ret;
}
goto endjob;
}
- if ((niothreads = qemuDomainGetIOThreadsMon(driver, vm, &iothreads)) < 0)
+ if ((ret = qemuDomainGetIOThreadsMon(driver, vm, &iothreads, &niothreads)) < 0)
goto endjob;
/* Nothing to do */
* IOThreads thread_id's, adjust the cgroups, thread affinity,
* and add the thread_id to the vm->def->iothreadids list.
*/
- if ((new_niothreads = qemuMonitorGetIOThreads(priv->mon,
- &new_iothreads)) < 0)
+ if (qemuMonitorGetIOThreads(priv->mon, &new_iothreads, &new_niothreads) < 0)
goto exit_monitor;
if (qemuDomainObjExitMonitor(driver, vm) < 0)
if (rc < 0)
goto exit_monitor;
- if ((new_niothreads = qemuMonitorGetIOThreads(priv->mon,
- &new_iothreads)) < 0)
+ if (qemuMonitorGetIOThreads(priv->mon, &new_iothreads, &new_niothreads) < 0)
goto exit_monitor;
if (qemuDomainObjExitMonitor(driver, vm) < 0)
qemuDomainObjPrivatePtr priv = dom->privateData;
size_t i;
qemuMonitorIOThreadInfoPtr *iothreads = NULL;
- int niothreads;
+ int niothreads = 0;
int ret = -1;
if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom))
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD))
return 0;
- if ((niothreads = qemuDomainGetIOThreadsMon(driver, dom, &iothreads)) < 0)
+ if (qemuDomainGetIOThreadsMon(driver, dom, &iothreads, &niothreads) < 0)
return -1;
/* qemuDomainGetIOThreadsMon returns a NULL-terminated list, so we must free
* qemuMonitorGetIOThreads:
* @mon: Pointer to the monitor
* @iothreads: Location to return array of IOThreadInfo data
+ * @niothreads: Count of the number of IOThreads in the array
*
* Issue query-iothreads command.
* Retrieve the list of iothreads defined/running for the machine
*
- * Returns count of IOThreadInfo structures on success
+ * Returns 0 on success
* -1 on error.
*/
int
qemuMonitorGetIOThreads(qemuMonitorPtr mon,
- qemuMonitorIOThreadInfoPtr **iothreads)
+ qemuMonitorIOThreadInfoPtr **iothreads,
+ int *niothreads)
{
VIR_DEBUG("iothreads=%p", iothreads);
QEMU_CHECK_MONITOR(mon);
- return qemuMonitorJSONGetIOThreads(mon, iothreads);
+ return qemuMonitorJSONGetIOThreads(mon, iothreads, niothreads);
}
/* Get the list of IOThreads from qemu */
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
goto cleanup;
- niothreads = qemuMonitorGetIOThreads(priv->mon, &iothreads);
+ ret = qemuMonitorGetIOThreads(priv->mon, &iothreads, &niothreads);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto cleanup;
- if (niothreads < 0)
+ if (ret < 0)
goto cleanup;
if (niothreads != vm->def->niothreadids) {