Hi,
> >> Migration fails and you want know why.
> >>
> >> Reason migration fails is the guest violates qxl specs (which doesn't
> >> cause actual problems unless you want migrate the guest).
> >
> > Then I agree error_report() is better ("Report an error to the current
> > monitor if we have one, else stderr").
>
> No good for QMP, I'm afraid.
>
> error_report() reports to stderr in QMP monitor context. To get an
> error to the QMP client, you need to use error_setg() and propagate all
> the way to the QMP core.
>
> Back to the patch. If the thing we report is actually an *error*,
> i.e. something that makes migration fail, then the QMP failure will
> contain an error message. That error must come from further up the call
> stack. If it's good enough, we don't need error_report() here. Else,
> we should error_setg() here.
Caller is here (migration/vmstate.c):
int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,
void *opaque, JSONWriter *vmdesc, int version_id)
{
[ ... ]
if (vmsd->pre_save) {
ret = vmsd->pre_save(opaque);
trace_vmstate_save_state_pre_save_res(vmsd->name, ret);
if (ret) {
error_report("pre-save failed: %s", vmsd->name);
return ret;
}
}
[ ... ]
}
No error_setg() anywhere close, it's error_report() all over the place.
I guess that makes adding error_report() the only short-term (aka 6.1)
option.
take care,
Gerd