cpu: Fix vendor for recent CPU models

Recent CPU models were specified using invalid vendor element
<vendor>NAME</vendor>, which was silently ignored due to a bug in the
code which was parsing it.
This commit is contained in:
Jiri Denemark 2010-10-13 11:42:19 +02:00
parent 677b7cf9b2
commit ac7afbeb9e
2 changed files with 15 additions and 8 deletions

View File

@ -355,7 +355,7 @@
</model>
<model name='Conroe'>
<vendor>Intel</vendor>
<vendor name='Intel'/>
<feature name='sse2'/>
<feature name='sse'/>
<feature name='fxsr'/>
@ -386,7 +386,7 @@
</model>
<model name='Penryn'>
<vendor>Intel</vendor>
<vendor name='Intel'/>
<feature name='sse2'/>
<feature name='sse'/>
<feature name='fxsr'/>
@ -419,7 +419,7 @@
</model>
<model name='Nehalem'>
<vendor>Intel</vendor>
<vendor name='Intel'/>
<feature name='sse2'/>
<feature name='sse'/>
<feature name='fxsr'/>
@ -454,7 +454,7 @@
</model>
<model name='Opteron_G1'>
<vendor>AMD</vendor>
<vendor name='AMD'/>
<feature name='sse2'/>
<feature name='sse'/>
<feature name='fxsr'/>
@ -483,7 +483,7 @@
</model>
<model name='Opteron_G2'>
<vendor>AMD</vendor>
<vendor name='AMD'/>
<feature name='sse2'/>
<feature name='sse'/>
<feature name='fxsr'/>
@ -516,7 +516,7 @@
</model>
<model name='Opteron_G3'>
<vendor>AMD</vendor>
<vendor name='AMD'/>
<feature name='sse2'/>
<feature name='sse'/>
<feature name='fxsr'/>

View File

@ -1015,8 +1015,15 @@ x86ModelLoad(xmlXPathContextPtr ctxt,
sizeof(*model->cpuid) * model->ncpuid);
}
vendor = virXPathString("string(./vendor/@name)", ctxt);
if (vendor) {
if (virXPathBoolean("boolean(./vendor)", ctxt)) {
vendor = virXPathString("string(./vendor/@name)", ctxt);
if (!vendor) {
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid vendor element in CPU model %s"),
model->name);
goto ignore;
}
if (!(model->vendor = x86VendorFind(map, vendor))) {
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown vendor %s referenced by CPU model %s"),