On Fri, Jun 01, 2018 at 06:04:29PM +0200, Jiri Denemark wrote:
On Fri, Jun 01, 2018 at 17:55:12 +0200, Jiri Denemark wrote:
> 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(a)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.
Well, I was wrong. Calling virReportEnumRangeError for both cases is OK.
Actally it was really only intended for the case where the enum value
is out of range. ie does not correspond to a known enum contant.
If it is a valid enum value, which is just not applicable in this usage
scenario, something else should be used, which reports the string version
of the error instead of a integer value.
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|