Rest of the fields of the iotune data structure did not check for malformed integers. Use the previously defined macro to extract them which will simplify the code and add error reporting. --- src/conf/domain_conf.c | 50 ++++++++------------------------------------------ 1 file changed, 8 insertions(+), 42 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3c066b4..64561df 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6694,48 +6694,14 @@ virDomainDiskDefIotuneParse(virDomainDiskDefPtr def, PARSE_IOTUNE(read_iops_sec); PARSE_IOTUNE(write_iops_sec); - if (virXPathULongLong("string(./iotune/total_bytes_sec_max)", - ctxt, - &def->blkdeviotune.total_bytes_sec_max) < 0) { - def->blkdeviotune.total_bytes_sec_max = 0; - } - - if (virXPathULongLong("string(./iotune/read_bytes_sec_max)", - ctxt, - &def->blkdeviotune.read_bytes_sec_max) < 0) { - def->blkdeviotune.read_bytes_sec_max = 0; - } - - if (virXPathULongLong("string(./iotune/write_bytes_sec_max)", - ctxt, - &def->blkdeviotune.write_bytes_sec_max) < 0) { - def->blkdeviotune.write_bytes_sec_max = 0; - } - - if (virXPathULongLong("string(./iotune/total_iops_sec_max)", - ctxt, - &def->blkdeviotune.total_iops_sec_max) < 0) { - def->blkdeviotune.total_iops_sec_max = 0; - } - - if (virXPathULongLong("string(./iotune/read_iops_sec_max)", - ctxt, - &def->blkdeviotune.read_iops_sec_max) < 0) { - def->blkdeviotune.read_iops_sec_max = 0; - } - - if (virXPathULongLong("string(./iotune/write_iops_sec_max)", - ctxt, - &def->blkdeviotune.write_iops_sec_max) < 0) { - def->blkdeviotune.write_iops_sec_max = 0; - } - - if (virXPathULongLong("string(./iotune/size_iops_sec)", - ctxt, - &def->blkdeviotune.size_iops_sec) < 0) { - def->blkdeviotune.size_iops_sec = 0; - } - + 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 ((def->blkdeviotune.total_bytes_sec && def->blkdeviotune.read_bytes_sec) || -- 2.8.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list