[PATCH 2/3] xml: drop unenforced minimum memory limit from RNG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
---
 docs/schemas/domaincommon.rng                      |    2 --
 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, 20 insertions(+), 15 deletions(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 6b62f73..68e3fdc 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3076,7 +3076,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 units attribute -->
@@ -3088,7 +3087,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 07565bc..9dac731 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7275,6 +7275,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 b590066..601c308 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 units='KiB'>219136</memory>
-  <currentMemory units='KiB'>219200</currentMemory>
+  <currentMemory units='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 3a7ed3d..0293df5 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 units='KiB'>219136</memory>
-  <currentMemory units='KiB'>219200</currentMemory>
+  <currentMemory units='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 fbf0ddc..30582b7 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 units='KiB'>219136</memory>
-  <currentMemory units='KiB'>219200</currentMemory>
+  <currentMemory units='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 75fdd81..4c9ed0d 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 units='KiB'>219136</memory>
-  <currentMemory units='KiB'>219200</currentMemory>
+  <currentMemory units='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 70e025e..4b5bb47 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 units='KiB'>219136</memory>
-  <currentMemory units='KiB'>219200</currentMemory>
+  <currentMemory units='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 736a283..50c9282 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 units='KiB'>219136</memory>
-  <currentMemory units='KiB'>219200</currentMemory>
+  <currentMemory units='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 b867f01..d20f3d9 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 units='KiB'>219136</memory>
-  <currentMemory units='KiB'>219200</currentMemory>
+  <currentMemory units='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 6b20e67..cec9b0b 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 units='KiB'>219136</memory>
-  <currentMemory units='KiB'>219200</currentMemory>
+  <currentMemory units='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 68b149e..4f00f44 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 units='KiB'>219136</memory>
-  <currentMemory units='KiB'>219200</currentMemory>
+  <currentMemory units='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 214a38f..33421b0 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 units='KiB'>219136</memory>
-  <currentMemory units='KiB'>219200</currentMemory>
+  <currentMemory units='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 038e008..5897bf1 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 units='KiB'>219136</memory>
-  <currentMemory units='KiB'>219200</currentMemory>
+  <currentMemory units='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 c7e34dc..b9a1cdd 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 units='KiB'>219136</memory>
-  <currentMemory units='KiB'>219200</currentMemory>
+  <currentMemory units='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 6b4e1c7..e5a9ce8 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 units='KiB'>219136</memory>
-  <currentMemory units='KiB'>219200</currentMemory>
+  <currentMemory units='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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]