qemu: Check for job being set when getting iothread stats

The qemuDomainGetStatsIOThread() accesses the monitor by calling
qemuDomainGetIOThreadsMon(). And it's also marked as "need
monitor" in qemuDomainGetStatsWorkers[]. However, it's not
checking if acquiring job was successful.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
Michal Privoznik 2019-11-07 13:43:21 +01:00
parent 1faf74050f
commit 3d46d684d1

View File

@ -21194,7 +21194,7 @@ static int
qemuDomainGetStatsIOThread(virQEMUDriverPtr driver, qemuDomainGetStatsIOThread(virQEMUDriverPtr driver,
virDomainObjPtr dom, virDomainObjPtr dom,
virTypedParamListPtr params, virTypedParamListPtr params,
unsigned int privflags G_GNUC_UNUSED) unsigned int privflags)
{ {
qemuDomainObjPrivatePtr priv = dom->privateData; qemuDomainObjPrivatePtr priv = dom->privateData;
size_t i; size_t i;
@ -21202,7 +21202,7 @@ qemuDomainGetStatsIOThread(virQEMUDriverPtr driver,
int niothreads; int niothreads;
int ret = -1; int ret = -1;
if (!virDomainObjIsActive(dom)) if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom))
return 0; return 0;
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD))