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>
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;
}