[PATCH 10/12] conf: Adjust the PARSE_IOTUNE macro

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

 



Unlike formatting we can parse in any order - this just makes it look like
there are less lines. A subsequent patch will add 6 more fields to parse and
that will look better.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f53d6c5..861a15d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7127,6 +7127,13 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
         virReportError(VIR_ERR_XML_ERROR,                                      \
                        _("disk iotune field '%s' must be an integer"), #val);  \
         return -1;                                                             \
+    }                                                                          \
+    if (virXPathULongLong("string(./iotune/" #val "_max)",                     \
+                          ctxt, &def->blkdeviotune.val##_max) == -2) {         \
+        virReportError(VIR_ERR_XML_ERROR,                                      \
+                       _("disk iotune field '%s_max' must be an integer"),     \
+                       #val);                                                  \
+        return -1;                                                             \
     }
 
 static int
@@ -7140,14 +7147,13 @@ virDomainDiskDefIotuneParse(virDomainDiskDefPtr def,
     PARSE_IOTUNE(read_iops_sec);
     PARSE_IOTUNE(write_iops_sec);
 
-    PARSE_IOTUNE(total_bytes_sec_max);
-    PARSE_IOTUNE(read_bytes_sec_max);
-    PARSE_IOTUNE(write_bytes_sec_max);
-    PARSE_IOTUNE(total_iops_sec_max);
-    PARSE_IOTUNE(read_iops_sec_max);
-    PARSE_IOTUNE(write_iops_sec_max);
-
-    PARSE_IOTUNE(size_iops_sec);
+    if (virXPathULongLong("string(./iotune/size_iops_sec)",
+                          ctxt, &def->blkdeviotune.size_iops_sec) == -2) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("disk iotune field 'size_iops_sec' must be "
+                         "an integer"));
+        return -1;
+    }
 
     if ((def->blkdeviotune.total_bytes_sec &&
          def->blkdeviotune.read_bytes_sec) ||
-- 
2.7.4

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