[libvirt] [PATCHv2] 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f959b74..c72702d 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1711,7 +1711,9 @@ qemuMonitorGetMemoryStats(qemuMonitorPtr mon, QEMU_CHECK_MONITOR(mon); if (mon->json) { - ignore_value(qemuMonitorFindBalloonObjectPath(mon, "/")); + if (mon->vm->def->memballoon && + mon->vm->def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE) + ignore_value(qemuMonitorFindBalloonObjectPath(mon, "/")); mon->ballooninit = true; return qemuMonitorJSONGetMemoryStats(mon, mon->balloonpath, stats, nr_stats); -- 1.7.12.4

On Sat, May 30, 2015 at 10:28:05 +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.
Signed-off-by: Wang Yufei <james.wangyufei@huawei.com> Signed-off-by: Zhang Bo <oscar.zhangbo@huawei.com> --- src/qemu/qemu_monitor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f959b74..c72702d 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1711,7 +1711,9 @@ qemuMonitorGetMemoryStats(qemuMonitorPtr mon, QEMU_CHECK_MONITOR(mon);
if (mon->json) { - ignore_value(qemuMonitorFindBalloonObjectPath(mon, "/")); + if (mon->vm->def->memballoon && + mon->vm->def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE) + ignore_value(qemuMonitorFindBalloonObjectPath(mon, "/")); mon->ballooninit = true; return qemuMonitorJSONGetMemoryStats(mon, mon->balloonpath, stats, nr_stats);
NACK, see my reply to v1. Peter
participants (2)
-
Peter Krempa
-
Wang Yufei