Re: [libvirt] [PATCHv2 07/15] xml: drop unenforced minimum memory limit from RNG

2012-03-06 Thread Peter Krempa

On 03/06/2012 01:34 AM, Eric Blake wrote:

The test domain allows0, 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.
---


ACK,

Peter

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCHv2 07/15] xml: drop unenforced minimum memory limit from RNG

2012-03-05 Thread Eric Blake
The test domain allows 0, 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 @@

   
   
 
@@ -3072,6 +3068,7 @@
   -1
 
   
+  
   
 
   [0-9]+
@@ -3083,7 +3080,6 @@
   
 
   [0-9]+
-  4000
 
   
   
@@ -3095,7 +3091,6 @@
 
 
   [0-9]+
-  4000
 
   
   
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 @@
   QEMUGuest1
   c7a5fdbd-edaf-9455-926a-d65c16db1809
   219136
-  219200
+  219136
   1
   
 hvm
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 @@
   QEMUGuest1
   c7a5fdbd-edaf-9455-926a-d65c16db1809
   219136
-  219200
+  219136
   1
   
 hvm
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 @@
   QEMUGuest1
   c7a5fdbd-edaf-9455-926a-d65c16db1809
   219136
-  219200
+  219136
   1
   
 hvm
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 @@
   QEMUGuest1
   c7a5fdbd-edaf-9455-926a-d65c16db1809
   219136
-  219200
+  219136
   1
   
 hvm
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 @@
   QEMUGuest1
   c7a5fdbd-edaf-9455-926a-d65c16db1809
   219136
-  219200
+  219136
   1
   
 hvm
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml 
b/tests/qemuxml2ar