[libvirt] [PATCH 1/2] qemu: Report error on unexpected job stats type
Jiri Denemark
jdenemar at redhat.com
Fri Jun 1 15:55:12 UTC 2018
On Fri, Jun 01, 2018 at 17:31:02 +0200, Peter Krempa wrote:
> On Fri, Jun 01, 2018 at 10:46:02 +0200, Jiri Denemark wrote:
> > If we ever fail to properly set jobinfo->statsType,
> > qemuDomainJobInfoToParams would return -1 without setting an error.
> >
> > Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> > ---
> > src/qemu/qemu_domain.c | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> > index 2c51e4c0d8..360379b26c 100644
> > --- a/src/qemu/qemu_domain.c
> > +++ b/src/qemu/qemu_domain.c
> > @@ -717,10 +717,12 @@ qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
> > return qemuDomainDumpJobInfoToParams(jobInfo, type, params, nparams);
> >
> > case QEMU_DOMAIN_JOB_STATS_TYPE_NONE:
> > - break;
> > + default:
> > + virReportError(VIR_ERR_INTERNAL_ERROR,
> > + _("unexpected type of job stats: %d"),
> > + jobInfo->statsType);
>
> virReportEnumRangeError?
Right, in that case, I need to split default and NONE branch, and report
different errors for each of them.
>
> > + return -1;
>
> ACK, ...
>
>
> > }
> > -
> > - return -1;
>
> .. but only push it during the freeze with the above part dropped. I'm
> not going to second-guess which compiler decides that the function will
> be missing a return statement.
OK, I'll wait after the release.
Jirka
More information about the libvir-list
mailing list