[PATCH 09/23] qemu: add max iotune settings check to virDomainBlockIoTuneValidate

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

 



Now only qemu and test drivers support iotunes and for both of them this check
makes sense. I guess there is little chance that this patch will break loading
of some domains with incorrect config though. If this is the issue then we can
put this common check to a different place.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
---
 src/conf/domain_conf.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 173424a..800bca5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8663,6 +8663,35 @@ virDomainBlockIoTuneValidate(virDomainBlockIoTuneInfoPtr iotune)
         return -1;
     }
 
+#define CHECK_MAX(val) \
+    do { \
+        if (iotune->val##_max) { \
+            if (!iotune->val) { \
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
+                               _("value '%s' cannot be set if " \
+                                 "'%s' is not set"), \
+                               #val "_max", #val); \
+                return -1; \
+            } \
+            if (iotune->val##_max < iotune->val) { \
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
+                               _("value '%s' cannot be " \
+                                 "smaller than '%s'"), \
+                               #val "_max", #val); \
+                return -1; \
+            } \
+        } \
+    } while (false)
+
+    CHECK_MAX(total_bytes_sec);
+    CHECK_MAX(read_bytes_sec);
+    CHECK_MAX(write_bytes_sec);
+    CHECK_MAX(total_iops_sec);
+    CHECK_MAX(read_iops_sec);
+    CHECK_MAX(write_iops_sec);
+
+#undef CHECK_MAX
+
     return 0;
 }
 
-- 
1.8.3.1




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

  Powered by Linux