xml: drop unenforced minimum memory limit from RNG

The test domain allows <memory>0</memory>, but the RNG was stating
that memory had to be at least 4096000 bytes.  Hypervisors should
enforce their own limits, rather than complicating the RNG.

Meanwhile, some copy and paste had introduced some fishy constructs
in various unit tests.

* docs/schemas/domaincommon.rng (memoryKB, memoryKBElement): Drop
limit that isn't enforced in code.
* src/conf/domain_conf.c (virDomainDefParseXML): Require current
<= maximum.
* tests/qemuxml2argvdata/*.xml: Fix offenders.
This commit is contained in:
Eric Blake 2012-02-22 21:18:39 -07:00
parent 2e14861224
commit 1b1402b90f
15 changed files with 21 additions and 19 deletions

View File

@ -3077,10 +3077,6 @@
<!--
Type library
A domain name should be made of ascii, numbers, _-+ and is non-empty
memoryKB request at least 4Mbytes though Xen will grow bigger if too low
weight currently is in range [100, 1000]
-->
<define name="cpuset">
<data type="string">
@ -3122,6 +3118,7 @@
<param name="minInclusive">-1</param>
</data>
</define>
<!-- weight currently is in range [100, 1000] -->
<define name="weight">
<data type="unsignedInt">
<param name="pattern">[0-9]+</param>
@ -3133,7 +3130,6 @@
<define name="memoryKB">
<data type="unsignedInt">
<param name="pattern">[0-9]+</param>
<param name="minInclusive">4000</param>
</data>
</define>
<!-- Memory as an element, with optional unit attribute -->
@ -3145,7 +3141,6 @@
</optional>
<data type='unsignedInt'>
<param name='pattern'>[0-9]+</param>
<param name='minInclusive'>4000</param>
</data>
</define>
<define name="domainName">

View File

@ -7625,6 +7625,13 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
&def->mem.cur_balloon) < 0)
def->mem.cur_balloon = def->mem.max_balloon;
if (def->mem.cur_balloon > def->mem.max_balloon) {
virDomainReportError(VIR_ERR_XML_ERROR,
_("current memory '%luk' exceeds maximum '%luk'"),
def->mem.cur_balloon, def->mem.max_balloon);
goto error;
}
node = virXPathNode("./memoryBacking/hugepages", ctxt);
if (node)
def->mem.hugepage_backed = 1;

View File

@ -2,7 +2,7 @@
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219200</currentMemory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>

View File

@ -2,7 +2,7 @@
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219200</currentMemory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>

View File

@ -2,7 +2,7 @@
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219200</currentMemory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>

View File

@ -2,7 +2,7 @@
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219200</currentMemory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>

View File

@ -2,7 +2,7 @@
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219200</currentMemory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>

View File

@ -2,7 +2,7 @@
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219200</currentMemory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>

View File

@ -2,7 +2,7 @@
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219200</currentMemory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>

View File

@ -2,7 +2,7 @@
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219200</currentMemory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>

View File

@ -2,7 +2,7 @@
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219200</currentMemory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>

View File

@ -2,7 +2,7 @@
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219200</currentMemory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>

View File

@ -2,7 +2,7 @@
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219200</currentMemory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>

View File

@ -2,7 +2,7 @@
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219200</currentMemory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>

View File

@ -2,7 +2,7 @@
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219200</currentMemory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>