conf: cpu: Fix parsing of vendor_id

This patch fixes a problem that vendor_id attribute can not be defined
when fallback attribute is not defined.

If I define domain xml like below:
<domain>
  <cpu>
    <model vendor_id='aaaabbbbcccc'>core2duo</model>
  </cpu>
</domain>

In dumpxml, vendor_id is not reflected:
<domain>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
  </cpu>
</domain>

The expected output is:
<domain>
  <cpu mode='custom' match='exact'>
    <model fallback='allow' vendor_id='aaaabbbbcccc'>core2duo</model>
  </cpu>
</domain>

If the fallback attribute and vendor_id attribute is defined at the same
time, it's reflected as expected.

Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
This commit is contained in:
Ken ICHIKAWA 2012-12-17 17:05:59 +09:00 committed by Peter Krempa
parent 77d3a80974
commit 1190a82469

View File

@ -300,6 +300,7 @@ virCPUDefParseXML(const xmlNodePtr node,
goto error;
}
}
}
if (virXPathBoolean("boolean(./model[1]/@vendor_id)", ctxt)) {
char *vendor_id;
@ -327,7 +328,6 @@ virCPUDefParseXML(const xmlNodePtr node,
def->vendor_id = vendor_id;
}
}
}
def->vendor = virXPathString("string(./vendor[1])", ctxt);
if (def->vendor && !def->model) {