提交 61d12533 编写于 作者: J John Ferlan

qemu: Don't fail stats collection due to IOThread capability

Commit 212dc928 made a generic qemuDomainGetIOThreadsMon which
would fail if the QEMU_CAPS_OBJECT_IOTHREAD didn't exist. Then
commit d1eac927 used that helper for the collection of all domain
stats. However, if the capability doesn't exist, then the entire
stats collection fails. Since the IOThread stats were meant to be
if available only, thus rather than failing if the capability
doesn't exist, let's just not collect the stats. Restore the caps
failure logic for qemuDomainGetIOThreadsLive.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 e1fc7ec0
...@@ -5498,16 +5498,9 @@ qemuDomainGetIOThreadsMon(virQEMUDriverPtr driver, ...@@ -5498,16 +5498,9 @@ qemuDomainGetIOThreadsMon(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
qemuMonitorIOThreadInfoPtr **iothreads) qemuMonitorIOThreadInfoPtr **iothreads)
{ {
qemuDomainObjPrivatePtr priv; qemuDomainObjPrivatePtr priv = vm->privateData;
int niothreads = 0; 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); qemuDomainObjEnterMonitor(driver, vm);
niothreads = qemuMonitorGetIOThreads(priv->mon, iothreads); niothreads = qemuMonitorGetIOThreads(priv->mon, iothreads);
if (qemuDomainObjExitMonitor(driver, vm) < 0 || niothreads < 0) if (qemuDomainObjExitMonitor(driver, vm) < 0 || niothreads < 0)
...@@ -5522,6 +5515,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver, ...@@ -5522,6 +5515,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainIOThreadInfoPtr **info) virDomainIOThreadInfoPtr **info)
{ {
qemuDomainObjPrivatePtr priv;
qemuMonitorIOThreadInfoPtr *iothreads = NULL; qemuMonitorIOThreadInfoPtr *iothreads = NULL;
virDomainIOThreadInfoPtr *info_ret = NULL; virDomainIOThreadInfoPtr *info_ret = NULL;
int niothreads = 0; int niothreads = 0;
...@@ -5537,6 +5531,13 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver, ...@@ -5537,6 +5531,13 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver,
goto endjob; 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;
}
if ((niothreads = qemuDomainGetIOThreadsMon(driver, vm, &iothreads)) < 0) if ((niothreads = qemuDomainGetIOThreadsMon(driver, vm, &iothreads)) < 0)
goto endjob; goto endjob;
...@@ -20882,6 +20883,7 @@ qemuDomainGetStatsIOThread(virQEMUDriverPtr driver, ...@@ -20882,6 +20883,7 @@ qemuDomainGetStatsIOThread(virQEMUDriverPtr driver,
int *maxparams, int *maxparams,
unsigned int privflags ATTRIBUTE_UNUSED) unsigned int privflags ATTRIBUTE_UNUSED)
{ {
qemuDomainObjPrivatePtr priv = dom->privateData;
size_t i; size_t i;
qemuMonitorIOThreadInfoPtr *iothreads = NULL; qemuMonitorIOThreadInfoPtr *iothreads = NULL;
int niothreads; int niothreads;
...@@ -20890,6 +20892,9 @@ qemuDomainGetStatsIOThread(virQEMUDriverPtr driver, ...@@ -20890,6 +20892,9 @@ qemuDomainGetStatsIOThread(virQEMUDriverPtr driver,
if (!virDomainObjIsActive(dom)) if (!virDomainObjIsActive(dom))
return 0; return 0;
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD))
return 0;
if ((niothreads = qemuDomainGetIOThreadsMon(driver, dom, &iothreads)) < 0) if ((niothreads = qemuDomainGetIOThreadsMon(driver, dom, &iothreads)) < 0)
return -1; return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册