[libvirt] [PATCH 4/4] qemu: json monitor: reduce duplicated code