Re: [PATCHv3 27/27] conf: Enforce ranges on cputune variables

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

 



On 03/11/13 16:06, Peter Krempa wrote:
The limits are documented at
http://libvirt.org/formatdomain.html#elementsCPUTuning . Enforce them
when going through XML parsing in addition to being enforced by the API.
---
  src/conf/domain_conf.c | 37 +++++++++++++++++++++++++++++++++++++
  1 file changed, 37 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fbdab9a..be3bf1a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2493,6 +2493,43 @@ virDomainDefVerifyInternal(virDomainDefPtr def,
          return -1;
      }

+    /* enforce range checks for cputune values */
+    /* these are not represented in the XML schema, but are documented */
+    if (def->cputune.period > 0 &&
+        (def->cputune.period < 1000 || def->cputune.period > 1000000)) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",

Hmm, in retrospect, I think VIR_ERR_CONFIG_UNSUPPORTED will be more appropriate here.

+                       _("Value of cputune period must be in range "
+                         "[1000, 1000000]"));
+        return -1;
+    }

Peter

--
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]