[libvirt] [PATCHv3] qemu: fix unsuitable error report when get memory stats

From: Zhang Bo <oscar.zhangbo@huawei.com> when we run the command 'virsh dommemstat xxx', althrough memballoon's model is set 'none' in vm's XML, it still reports an error in libvirtd.log. error : qemuMonitorFindBalloonObjectPath:1042 : internal error: Cannot determine balloon device path Apparently, if we don't set memballoon, we don't need to set balloon device path. Signed-off-by: Wang Yufei <james.wangyufei@huawei.com> Signed-off-by: Zhang Bo <oscar.zhangbo@huawei.com> --- src/qemu/qemu_monitor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f959b74..8c3c6f3 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1169,8 +1169,10 @@ qemuMonitorFindBalloonObjectPath(qemuMonitorPtr mon, if (mon->balloonpath) { return 0; } else if (mon->ballooninit) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot determine balloon device path")); + if (vm->def->memballoon && + vm->def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE) + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot determine balloon device path")); return -1; } -- 1.7.12.4

On Wed, Jun 03, 2015 at 09:07:49AM +0800, Wang Yufei wrote:
From: Zhang Bo <oscar.zhangbo@huawei.com>
when we run the command 'virsh dommemstat xxx', althrough memballoon's model is set 'none' in vm's XML, it still reports an error in libvirtd.log. error : qemuMonitorFindBalloonObjectPath:1042 : internal error: Cannot determine balloon device path Apparently, if we don't set memballoon, we don't need to set balloon device path.
This doesn't happen to me, there must be some information missing. Or maybe you haven't tried it with the current master.
Signed-off-by: Wang Yufei <james.wangyufei@huawei.com> Signed-off-by: Zhang Bo <oscar.zhangbo@huawei.com> --- src/qemu/qemu_monitor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f959b74..8c3c6f3 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1169,8 +1169,10 @@ qemuMonitorFindBalloonObjectPath(qemuMonitorPtr mon, if (mon->balloonpath) { return 0; } else if (mon->ballooninit) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot determine balloon device path")); + if (vm->def->memballoon && + vm->def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE) + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot determine balloon device path"));
Anyway, you're missing curly brackets around two-line body.
return -1;
And you still return -1, so instead of error : qemuMonitorFindBalloonObjectPath:1042 : internal error: Cannot determine balloon device path you'll probably get the catch-all: An error occurred, but the cause is unknown
}
-- 1.7.12.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Wed, Jun 03, 2015 at 09:07:49AM +0800, Wang Yufei wrote:
From: Zhang Bo <oscar.zhangbo@huawei.com>
when we run the command 'virsh dommemstat xxx', althrough memballoon's model is set 'none' in vm's XML, it still reports an error in libvirtd.log. error : qemuMonitorFindBalloonObjectPath:1042 : internal error: Cannot determine balloon device path Apparently, if we don't set memballoon, we don't need to set balloon device path.
We shouldn't even be calling qemuMonitorFindBalloonObjectPath if there is no balloon device. I have sent a patch that moves the check to qemuDomainMemoryStats as a part of a larger series: https://www.redhat.com/archives/libvir-list/2015-June/msg00213.html Jan
Signed-off-by: Wang Yufei <james.wangyufei@huawei.com> Signed-off-by: Zhang Bo <oscar.zhangbo@huawei.com> --- src/qemu/qemu_monitor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
participants (3)
-
Ján Tomko
-
Martin Kletzander
-
Wang Yufei