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. --- rework of memory v1 2/3 v2: fix bogus comment regarding 4000KiB limit docs/schemas/domaincommon.rng | 7 +------ src/conf/domain_conf.c | 7 +++++++ .../qemuxml2argv-smartcard-controller.xml | 2 +- .../qemuxml2argv-smartcard-host-certificates.xml | 2 +- .../qemuxml2argv-smartcard-host.xml | 2 +- ...qemuxml2argv-smartcard-passthrough-spicevmc.xml | 2 +- .../qemuxml2argv-smartcard-passthrough-tcp.xml | 2 +- .../qemuxml2argv-usb-controller.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml | 2 +- .../qemuxml2argv-usb-ich9-companion.xml | 2 +- .../qemuxml2argv-usb-ich9-ehci-addr.xml | 2 +- .../qemuxml2argv-usb-piix3-controller.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml | 2 +- 15 files changed, 21 insertions(+), 19 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index c8b403e..99b3861 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3027,10 +3027,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"> @@ -3072,6 +3068,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> @@ -3083,7 +3080,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 --> @@ -3095,7 +3091,6 @@ </optional> <data type='unsignedInt'> <param name='pattern'>[0-9]+</param> - <param name='minInclusive'>4000</param> </data> </define> <define name="domainName"> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 331d923..41d0eca 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7303,6 +7303,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_INTERNAL_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; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.xml b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.xml index 1914c6b..3256010 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.xml @@ -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> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host-certificates.xml b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host-certificates.xml index 2f58068..d91afcc 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host-certificates.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host-certificates.xml @@ -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> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host.xml b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host.xml index b0415b3..7069279 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host.xml @@ -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> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-spicevmc.xml b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-spicevmc.xml index 33e2ee4..db42a11 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-spicevmc.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-spicevmc.xml @@ -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> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-tcp.xml b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-tcp.xml index 92fb31d..05a93c3 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-tcp.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-tcp.xml @@ -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> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml index 45d81b6..66657cf 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml @@ -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> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml index 14490e5..c013014 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml @@ -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> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-companion.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-companion.xml index b7b47cd..d12f67e 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-companion.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-companion.xml @@ -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> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml index 3237ef9..aa6c092 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml @@ -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> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-piix3-controller.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-piix3-controller.xml index d233544..58dbfb1 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-piix3-controller.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-piix3-controller.xml @@ -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> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml index 0cedf87..a6eebf5 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml @@ -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> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml index b0e8b45..fd23ec8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml @@ -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> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml index 572cb2b..b8a2ccf 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml @@ -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> -- 1.7.7.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list