[libvirt] [PATCH 2/2] conf: Provide error on undefined vcpusched entry

Peter Krempa pkrempa at redhat.com
Mon Aug 15 15:06:23 UTC 2016


On Mon, Aug 15, 2016 at 10:55:34 -0400, John Ferlan wrote:
> Commit id '9cc931f0b' removed the error message; however, it was reachable
> via the virsh edit of a domain and attempting to add a vcpusched element
> for "undefined" vcpu values.  Without the error, the generic message
> "An error occurred, but the cause is unknown" is displayed.
> 
> This is similar to bz 1366484 for the iothreadsched element.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/conf/domain_conf.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 9037304..caebe99 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -1467,8 +1467,12 @@ virDomainVcpuDefPtr
>  virDomainDefGetVcpu(virDomainDefPtr def,
>                      unsigned int vcpu)
>  {
> -    if (vcpu >= def->maxvcpus)
> +    if (vcpu >= def->maxvcpus) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                       _("vCPU '%u' is not present in domain definition"),
> +                       vcpu);
>          return NULL;
> +    }

This error would be overwritten by the many callers that care if it's
not found and report bogus error in cases where failure is okay.

The specific code path that cares should report the error.

NACK.




More information about the libvir-list mailing list