mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
qemu: prefer .requiredCaps for VIR_DOMAIN_STATS_IOTHREAD
Since f29d7c3e69
we have an option for checking capabilities
required for given type of statistics upfront, instead of the
callback. Switch qemuDomainGetStatsIOThread() callback to the new
style.
This will now error out properly if user requests IOTHREAD stats
forcibly (via VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS
flag) but QEMU doesn't support IOThreads. Previously, this was
silently ignored.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
9f56686bf0
commit
2c6b8cb507
@ -18513,7 +18513,6 @@ qemuDomainGetStatsIOThread(virQEMUDriver *driver,
|
|||||||
virTypedParamList *params,
|
virTypedParamList *params,
|
||||||
unsigned int privflags)
|
unsigned int privflags)
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivate *priv = dom->privateData;
|
|
||||||
size_t i;
|
size_t i;
|
||||||
qemuMonitorIOThreadInfo **iothreads = NULL;
|
qemuMonitorIOThreadInfo **iothreads = NULL;
|
||||||
int niothreads = 0;
|
int niothreads = 0;
|
||||||
@ -18522,9 +18521,6 @@ qemuDomainGetStatsIOThread(virQEMUDriver *driver,
|
|||||||
if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom))
|
if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (qemuDomainGetIOThreadsMon(driver, dom, &iothreads, &niothreads) < 0)
|
if (qemuDomainGetIOThreadsMon(driver, dom, &iothreads, &niothreads) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -18665,6 +18661,12 @@ struct qemuDomainGetStatsWorker {
|
|||||||
virQEMUCapsFlags *requiredCaps;
|
virQEMUCapsFlags *requiredCaps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static virQEMUCapsFlags queryIOThreadRequired[] = {
|
||||||
|
QEMU_CAPS_OBJECT_IOTHREAD,
|
||||||
|
QEMU_CAPS_LAST
|
||||||
|
};
|
||||||
|
|
||||||
static virQEMUCapsFlags queryDirtyRateRequired[] = {
|
static virQEMUCapsFlags queryDirtyRateRequired[] = {
|
||||||
QEMU_CAPS_QUERY_DIRTY_RATE,
|
QEMU_CAPS_QUERY_DIRTY_RATE,
|
||||||
QEMU_CAPS_LAST
|
QEMU_CAPS_LAST
|
||||||
@ -18678,7 +18680,7 @@ static struct qemuDomainGetStatsWorker qemuDomainGetStatsWorkers[] = {
|
|||||||
{ qemuDomainGetStatsInterface, VIR_DOMAIN_STATS_INTERFACE, false, NULL },
|
{ qemuDomainGetStatsInterface, VIR_DOMAIN_STATS_INTERFACE, false, NULL },
|
||||||
{ qemuDomainGetStatsBlock, VIR_DOMAIN_STATS_BLOCK, true, NULL },
|
{ qemuDomainGetStatsBlock, VIR_DOMAIN_STATS_BLOCK, true, NULL },
|
||||||
{ qemuDomainGetStatsPerf, VIR_DOMAIN_STATS_PERF, false, NULL },
|
{ qemuDomainGetStatsPerf, VIR_DOMAIN_STATS_PERF, false, NULL },
|
||||||
{ qemuDomainGetStatsIOThread, VIR_DOMAIN_STATS_IOTHREAD, true, NULL },
|
{ qemuDomainGetStatsIOThread, VIR_DOMAIN_STATS_IOTHREAD, true, queryIOThreadRequired },
|
||||||
{ qemuDomainGetStatsMemory, VIR_DOMAIN_STATS_MEMORY, false, NULL },
|
{ qemuDomainGetStatsMemory, VIR_DOMAIN_STATS_MEMORY, false, NULL },
|
||||||
{ qemuDomainGetStatsDirtyRate, VIR_DOMAIN_STATS_DIRTYRATE, true, queryDirtyRateRequired },
|
{ qemuDomainGetStatsDirtyRate, VIR_DOMAIN_STATS_DIRTYRATE, true, queryDirtyRateRequired },
|
||||||
{ NULL, 0, false, NULL }
|
{ NULL, 0, false, NULL }
|
||||||
|
Loading…
Reference in New Issue
Block a user