]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuMonitorJSONHandleMigrationStatus: Simplify error case
authorPeter Krempa <pkrempa@redhat.com>
Wed, 4 Feb 2026 09:47:53 +0000 (10:47 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 12 Feb 2026 15:45:34 +0000 (16:45 +0100)
Report both missing 'status' and invalid value in a single error
message. Also use the proper spelling of the event name (all caps).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_monitor_json.c

index 1b05c713ea8857b5abb3132dd43d42a3b61817c4..021995f5ccc8381b9cd343e96c3f7db14061675d 100644 (file)
@@ -1268,13 +1268,10 @@ qemuMonitorJSONHandleMigrationStatus(qemuMonitor *mon,
     const char *str;
     int status;
 
-    if (!(str = virJSONValueObjectGetString(data, "status"))) {
-        VIR_WARN("missing status in migration event");
-        return;
-    }
-
-    if ((status = qemuMonitorMigrationStatusTypeFromString(str)) == -1) {
-        VIR_WARN("unknown status '%s' in migration event", str);
+    if (!(str = virJSONValueObjectGetString(data, "status")) ||
+        (status = qemuMonitorMigrationStatusTypeFromString(str)) == -1) {
+        VIR_WARN("Missing or unknown value '%s' of 'status' in 'MIGRATION' event",
+                 NULLSTR(str));
         return;
     }