]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
xml: drop unenforced minimum memory limit from RNG
authorEric Blake <eblake@redhat.com>
Thu, 23 Feb 2012 04:18:39 +0000 (21:18 -0700)
committerEric Blake <eblake@redhat.com>
Thu, 8 Mar 2012 01:24:43 +0000 (18:24 -0700)
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.

15 files changed:
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.xml
tests/qemuxml2argvdata/qemuxml2argv-smartcard-host-certificates.xml
tests/qemuxml2argvdata/qemuxml2argv-smartcard-host.xml
tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-spicevmc.xml
tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-tcp.xml
tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml
tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml
tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-companion.xml
tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml
tests/qemuxml2argvdata/qemuxml2argv-usb-piix3-controller.xml
tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml
tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml
tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml

index 53389b07825d142f016676418f4eb4e0b21a9c6e..0d97044a082d2bb3ecc9d80588f91547857c304c 100644 (file)
 
   <!--
        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">
       <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>
   <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 -->
     </optional>
     <data type='unsignedInt'>
       <param name='pattern'>[0-9]+</param>
-      <param name='minInclusive'>4000</param>
     </data>
   </define>
   <define name="domainName">
index 6162c4ed4e4bed804cd3c9bab0ef577e6d59cc72..16ab9d40228c81fb72cfaae36deaea81e6c108a2 100644 (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;
index 1914c6bcc538b0a693206cb8cbd78c2e4bf08e16..32560106ff71b3cd954cedb5541f48435bb1171f 100644 (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>
index 2f5806808ec2acfcf3662f5b9c2dcaedd09a0d48..d91afcc4bf91d2999bf1a857dd12b0b1779a4791 100644 (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>
index b0415b341437c699c1765b7e4b3dedf7e738e6a0..7069279226f3a1299a94a697437b318ddbf270fc 100644 (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>
index 33e2ee4067284efbe33fc06d695509d2bbaf304a..db42a116bceaf97866a7b1f95144847b65dcdd75 100644 (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>
index 92fb31d1024e0106b99ccc2ce20b97cb7de2653f..05a93c3e1cb2e3dee78763a9018d5dfa8674b5ea 100644 (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>
index 45d81b6957fa18ac53755f0055cfa2f2221ffbe8..66657cfd2f498d05da6e9826a79ab5c5f9ecdb19 100644 (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>
index 14490e5058367089f66fafa801d18f4cfdaee57c..c01301443d6965666b09b0274880ecec9b4b331e 100644 (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>
index b7b47cdac6d0e87af17db367a1ab80b919acf7b5..d12f67e38989942de488650fef82ea324849c2aa 100644 (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>
index 3237ef9e2f73b2c64c536264eab4460ad4cb331a..aa6c092f3eb25f4b22a47340095c9525a286f8a1 100644 (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>
index d233544d96c8498f57e2565f12971fc36d9699a4..58dbfb1a8928044109677922e72e16a59662b3ee 100644 (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>
index 0cedf8714b10b59f713e90c5dfa82290f3ac90e1..a6eebf5c08f47bf8be6de941154bbac2b1783af6 100644 (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>
index b0e8b4545c53afe106c7784d5f601b708bcd3ad1..fd23ec8024f9a05af5e2393a2d32ea0603ad1275 100644 (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>
index 572cb2b516afdc15d618f9dc947a0d63f6c51935..b8a2ccfe43fd4827414de7ee00e243d7800448c5 100644 (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>