conf: virDomainDiskDefIotuneParse: Report malformed number errors

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.
This commit is contained in:
Peter Krempa 2016-04-12 15:03:19 +02:00
parent 112ae48192
commit 14e4c4e465

View File

@ -6699,48 +6699,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) ||