On Mon, Jan 11, 2021 at 12:49:58 +0300, Nikolay Shirokovskiy wrote:
> virDomainBlockIoTuneValidate can be reused in virDomainSetBlockIoTune
> implementations.
>
> And also simplify if conditions.
>
> Signed-off-by: Nikolay Shirokovskiy <[email protected]>
> ---
> src/conf/domain_conf.c | 78
> +++++++++++++++++++++++++-----------------------
> src/conf/domain_conf.h | 3 ++
> src/libvirt_private.syms | 1 +
> 3 files changed, 44 insertions(+), 38 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 349fc28..173424a 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
[...]
> +
> #define PARSE_IOTUNE(val) \
> if (virXPathULongLong("string(./iotune/" #val ")", \
> ctxt, &def->blkdeviotune.val) == -2) { \
> @@ -8665,45 +8704,8 @@ virDomainDiskDefIotuneParse(virDomainDiskDefPtr def,
[...]
> - virReportError(VIR_ERR_XML_ERROR, "%s",
> - _("total and read/write bytes_sec_max "
> - "cannot be set at the same time"));
> + if (virDomainBlockIoTuneValidate(&def->blkdeviotune) < 0)
> return -1;
This should be called from 'virDomainDiskDefValidate' rather than from
the parser.
With that:
Reviewed-by: Peter Krempa <[email protected]>