[PATCH 03/23] qemu: reuse validation in qemuDomainSetBlockIoTune

Peter Krempa pkrempa at redhat.com
Wed Mar 3 13:22:29 UTC 2021


On Mon, Jan 11, 2021 at 12:49:56 +0300, Nikolay Shirokovskiy wrote:
> There is a little difference though in removed and reused code in
> qemuDomainSetBlockIoTune.
> 
> First, removed code checked 'set_fields' instead of tune itself. set_fields is
> true whenever corresponding virDomainBlockIoTuneInfoHas* it true. But
> additionnaly it is true when 0 values are passed explicitly. So removed code
> also failed if reset value is passed and qemu does not support the resetted
> field. I guess this is not very useful check and can be dropped as result of
> this patch. If field is not supported then it is reported as 0 and resetting it
> to 0 is just NOP.

I'd say that it's an acceptable change.

> Second, check for QEMU_BLOCK_IOTUNE_MAX is added but it is alredy checked
> above and I'm going to remove the above check.

I'd not mention this.

> 
> Third, now check of qemuDomainSetBlockIoTune is done also if changing only
> persistent config is requested. It is good because otherwise we will create
> invalid config which can not be created thru define API due to existing qemu
> validation code.
> 
> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
> ---
>  src/qemu/qemu_driver.c | 31 ++++---------------------------
>  1 file changed, 4 insertions(+), 27 deletions(-)

Reviewed-by: Peter Krempa <pkrempa at redhat.com>




More information about the libvir-list mailing list