[libvirt] [PATCH] cpu: Fail when CPU type cannot be detected from XML
Jiri Denemark
jdenemar at redhat.com
Mon Jul 12 17:53:04 UTC 2010
> > diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
> > index d9aa69c..35bcce8 100644
> > --- a/src/conf/cpu_conf.c
> > +++ b/src/conf/cpu_conf.c
> > @@ -130,9 +130,15 @@ virCPUDefParseXML(const xmlNodePtr node,
> > }
> >
> > if (mode == VIR_CPU_TYPE_AUTO) {
> > - if (virXPathBoolean("boolean(./arch)", ctxt))
> > + if (virXPathBoolean("boolean(./arch)", ctxt)) {
> > + if (virXPathBoolean("boolean(./@match)", ctxt)) {
> > + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> > + _("'arch' element element cannot be used inside 'cpu'"
> > + " element with 'match' attribute'"));
> > + goto error;
> > + }
> > def->type = VIR_CPU_TYPE_HOST;
> > - else
> > + } else
> > def->type = VIR_CPU_TYPE_GUEST;
> > } else
> > def->type = mode;
>
> except since it's user provided data, we should use error
> VIR_ERR_XML_ERROR instead of VIR_ERR_INTERNAL_ERROR,
>
> ACK, once that is fixed
OK, I fixed the error code and pushed.
Jirka
More information about the libvir-list
mailing list