mirror of https://gitee.com/openkylin/libvirt.git
qemu: Split qemuDomainGetIOThreadsLive
Separate out the fetch of the IOThread monitor call into a separate helper so that a subsequent domain statistics change can fetch the raw IOThread data and parse it as it sees fit. Signed-off-by: John Ferlan <jferlan@redhat.com> ACKed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
d1c1f2c2f5
commit
212dc9286a
|
@ -5484,12 +5484,36 @@ qemuDomainGetMaxVcpus(virDomainPtr dom)
|
|||
VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainGetIOThreadsMon(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
qemuMonitorIOThreadInfoPtr **iothreads)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv;
|
||||
int niothreads = 0;
|
||||
|
||||
priv = vm->privateData;
|
||||
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("IOThreads not supported with this binary"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
qemuDomainObjEnterMonitor(driver, vm);
|
||||
niothreads = qemuMonitorGetIOThreads(priv->mon, iothreads);
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0 || niothreads < 0)
|
||||
return -1;
|
||||
|
||||
return niothreads;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainIOThreadInfoPtr **info)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv;
|
||||
qemuMonitorIOThreadInfoPtr *iothreads = NULL;
|
||||
virDomainIOThreadInfoPtr *info_ret = NULL;
|
||||
int niothreads = 0;
|
||||
|
@ -5505,18 +5529,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver,
|
|||
goto endjob;
|
||||
}
|
||||
|
||||
priv = vm->privateData;
|
||||
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("IOThreads not supported with this binary"));
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
qemuDomainObjEnterMonitor(driver, vm);
|
||||
niothreads = qemuMonitorGetIOThreads(priv->mon, &iothreads);
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||
goto endjob;
|
||||
if (niothreads < 0)
|
||||
if ((niothreads = qemuDomainGetIOThreadsMon(driver, vm, &iothreads)) < 0)
|
||||
goto endjob;
|
||||
|
||||
/* Nothing to do */
|
||||
|
@ -5546,8 +5559,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver,
|
|||
virBitmapFree(map);
|
||||
}
|
||||
|
||||
*info = info_ret;
|
||||
info_ret = NULL;
|
||||
VIR_STEAL_PTR(*info, info_ret);
|
||||
ret = niothreads;
|
||||
|
||||
endjob:
|
||||
|
|
Loading…
Reference in New Issue