[self-review]
On 09/29/2010 06:02 PM, Eric Blake wrote:
Two tightly-related changes. One: virDomainGetInfo implicitly limits
vcpus to a 16-bit number; so there's no need to pretend otherwise
through the rest of the code. Two: add a new maxvcpus member, but
for now, ensure that all domains treat vcpus == maxvcpus at all
times (domains that support hot-unplugging vcpus will be changed
in later patches).
@@ -4244,8 +4245,27 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
if (node)
def->hugepage_backed = 1;
- if (virXPathULong("string(./vcpu[1])", ctxt,&def->vcpus)< 0)
- def->vcpus = 1;
+ if (virXPathULong("string(./vcpu[1])", ctxt,&count)< 0)
+ def->maxvcpus = 1;
+ else {
+ def->maxvcpus = count;
+ if (def->maxvcpus != count || count == 0) {
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+ _("invalid maxvcpus %lu"), count);
Should this be VIR_ERR_XML_ERROR instead?
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org