[PATCH 00/23] RFC: get rid of macros when dealing with block io tunes

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Mon Jan 11 09:49:53 UTC 2021

Hi, all.

I started this work as adding missing parts/fixing issues/etc in block iotune
code but then turned to refactoring code. We use a lot of macros in this place
and if we get rid of them I belive we will have much more readable/reusable/
extendable code.

Most of macros usage is for iterating over unsigned long long values. I'm
talking about parsing/formating xml, converting from/to virTypedParameterPtr
list etc. These places do not care about tune semantics and thus we can
add tools for the said iteration. See patch [1] for the first such conversion.

Patches before it partially prepare for this conversion, partially just
improve code reuse and add missing parts.

The work on removing macros in code handling iotunes is not finished as
I wanted to get an approvement that I have taken a right direction. At the
same time series shows the potential of the approach (take a look on how
qemuDomainSetBlockIoTune and testDomainSetBlockIoTune are looking now!).

Some places like qemuDomainSetBlockIoTuneDefaults deal with fields semantics.
So we need another approach to remove macros there but it is a matter of
a different RFC.

Nikolay Shirokovskiy (23):
  qemu: pass supportGroupNameOption as expected
  qemu: factor out qemuValidateDomainBlkdeviotune
  qemu: reuse validation in qemuDomainSetBlockIoTune
  qemu: remove extra check for QEMU_BLOCK_IOTUNE_MAX
  conf: factor out virDomainBlockIoTuneValidate
  qemu: reuse virDomainBlockIoTuneValidate
  test driver: reuse virDomainBlockIoTuneValidate
  qemu: reset max iotune setting when needed
  qemu: add max iotune settings check to virDomainBlockIoTuneValidate
  qemu: remove iotune max checks
  test driver: remove iotune max checks
  qemu: prepare for removing qemuBlockIoTuneSetFlags
  qemu: use group_name instead of QEMU_BLOCK_IOTUNE_SET_GROUP_NAME
  qemu: remove qemuBlockIoTuneSetFlags usage in qemuDomainSetBlockIoTune
  qemu: remove qemuBlockIoTuneSetFlags enum completly
  conf: get rid of macros in virDomainDiskDefIotuneParse                    [1]
  conf: get rid of macros in virDomainDiskDefFormatIotune
  conf: add virDomainBlockIoTuneFromParams
  conf: add virDomainBlockIoTuneToEventParams
  qemu: qemuDomainSetBlockIoTune use functions to convert to/from params
  test driver: remove TEST_BLOCK_IOTUNE_MAX checks
  test driver: prepare to delete macros in testDomainSetBlockIoTune
  test driver: testDomainSetBlockIoTune: use functions to convert
    to/from params

 src/conf/domain_conf.c   | 303 +++++++++++++++++++++++++++++++++--------------
 src/conf/domain_conf.h   |  16 +++
 src/libvirt_private.syms |   3 +
 src/qemu/qemu_driver.c   | 281 ++++++++++++-------------------------------
 src/qemu/qemu_validate.c | 100 +++++++++-------
 src/qemu/qemu_validate.h |   4 +
 src/test/test_driver.c   | 156 ++----------------------
 7 files changed, 380 insertions(+), 483 deletions(-)


More information about the libvir-list mailing list