Remove all the mon->json checks in qemuMonitor functions. Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/qemu/qemu_monitor.c | 84 ++++++++++++----------------------------- 1 file changed, 25 insertions(+), 59 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 30c1b1e596..ab2b54e002 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1197,7 +1197,7 @@ qemuMonitorInitBalloonObjectPath(qemuMonitorPtr mon, /** * To update video memory size in status XML we need to load correct values from - * QEMU. This is supported only with JSON monitor. + * QEMU. * * Returns 0 on success, -1 on failure and sets proper error message. */ @@ -1211,29 +1211,25 @@ qemuMonitorUpdateVideoMemorySize(qemuMonitorPtr mon, QEMU_CHECK_MONITOR(mon); - if (mon->json) { - ret = qemuMonitorJSONFindLinkPath(mon, videoName, - video->info.alias, &path); - if (ret < 0) { - if (ret == -2) - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to find QOM Object path for " - "device '%s'"), videoName); - return -1; - } - - ret = qemuMonitorJSONUpdateVideoMemorySize(mon, video, path); - VIR_FREE(path); - return ret; + ret = qemuMonitorJSONFindLinkPath(mon, videoName, + video->info.alias, &path); + if (ret < 0) { + if (ret == -2) + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to find QOM Object path for " + "device '%s'"), videoName); + return -1; } - return 0; + ret = qemuMonitorJSONUpdateVideoMemorySize(mon, video, path); + VIR_FREE(path); + return ret; } /** * To update video vram64 size in status XML we need to load correct value from - * QEMU. This is supported only with JSON monitor. + * QEMU. * * Returns 0 on success, -1 on failure and sets proper error message. */ @@ -1247,23 +1243,19 @@ qemuMonitorUpdateVideoVram64Size(qemuMonitorPtr mon, QEMU_CHECK_MONITOR(mon); - if (mon->json) { - ret = qemuMonitorJSONFindLinkPath(mon, videoName, - video->info.alias, &path); - if (ret < 0) { - if (ret == -2) - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to find QOM Object path for " - "device '%s'"), videoName); - return -1; - } - - ret = qemuMonitorJSONUpdateVideoVram64Size(mon, video, path); - VIR_FREE(path); - return ret; + ret = qemuMonitorJSONFindLinkPath(mon, videoName, + video->info.alias, &path); + if (ret < 0) { + if (ret == -2) + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to find QOM Object path for " + "device '%s'"), videoName); + return -1; } - return 0; + ret = qemuMonitorJSONUpdateVideoVram64Size(mon, video, path); + VIR_FREE(path); + return ret; } @@ -1700,9 +1692,6 @@ qemuMonitorSetCapabilities(qemuMonitorPtr mon) { QEMU_CHECK_MONITOR(mon); - if (!mon->json) - return 0; - return qemuMonitorJSONSetCapabilities(mon); } @@ -2015,9 +2004,6 @@ qemuMonitorGetCPUInfo(qemuMonitorPtr mon, if (VIR_ALLOC_N(info, maxvcpus) < 0) return -1; - if (!mon->json) - hotplug = false; - /* initialize a few non-zero defaults */ qemuMonitorCPUInfoClear(info, maxvcpus); @@ -2168,9 +2154,6 @@ qemuMonitorSetMemoryStatsPeriod(qemuMonitorPtr mon, if (!mon) return -1; - if (!mon->json) - return -1; - if (period < 0) return -1; @@ -2696,10 +2679,6 @@ qemuMonitorGetDumpGuestMemoryCapability(qemuMonitorPtr mon, QEMU_CHECK_MONITOR(mon); - /* No capability is supported without JSON monitor */ - if (!mon->json) - return 0; - return qemuMonitorJSONGetDumpGuestMemoryCapability(mon, capability); } @@ -3303,7 +3282,7 @@ qemuMonitorBlockCommit(qemuMonitorPtr mon, const char *device, bool qemuMonitorSupportsActiveCommit(qemuMonitorPtr mon) { - if (!mon || !mon->json) + if (!mon) return false; return qemuMonitorJSONSupportsActiveCommit(mon); @@ -3854,10 +3833,6 @@ qemuMonitorGetMigrationCapabilities(qemuMonitorPtr mon, { QEMU_CHECK_MONITOR(mon); - /* No capability is supported without JSON monitor */ - if (!mon->json) - return 0; - return qemuMonitorJSONGetMigrationCapabilities(mon, capabilities); } @@ -4139,12 +4114,6 @@ qemuMonitorGetIOThreads(qemuMonitorPtr mon, QEMU_CHECK_MONITOR(mon); - /* Requires JSON to make the query */ - if (!mon->json) { - *iothreads = NULL; - return 0; - } - return qemuMonitorJSONGetIOThreads(mon, iothreads); } @@ -4191,9 +4160,6 @@ qemuMonitorGetMemoryDeviceInfo(qemuMonitorPtr mon, QEMU_CHECK_MONITOR(mon); - if (!mon->json) - return -2; - if (!(*info = virHashCreate(10, virHashValueFree))) return -1; -- 2.20.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list