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

Nikolay Shirokovskiy posted 23 patches 3 years, 3 months ago
Test syntax-check failed
Failed in applying to current master (apply log)
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(-)
[PATCH 00/23] RFC: get rid of macros when dealing with block io tunes
Posted by Nikolay Shirokovskiy 3 years, 3 months ago
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(-)

-- 
1.8.3.1

Re: [PATCH 00/23] RFC: get rid of macros when dealing with block io tunes
Posted by Nikolay Shirokovskiy 3 years, 3 months ago
Polite ping.

On Mon, Jan 11, 2021 at 12:49 PM Nikolay Shirokovskiy <
nshirokovskiy@virtuozzo.com> wrote:

> 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(-)
>
> --
> 1.8.3.1
>
>
Re: [PATCH 00/23] RFC: get rid of macros when dealing with block io tunes
Posted by Nikolay Shirokovskiy 3 years, 2 months ago
A ping to save this series from falling thru the cracks.

ср, 27 янв. 2021 г. в 11:19, Nikolay Shirokovskiy <
nshirokovskiy@virtuozzo.com>:

> Polite ping.
>
> On Mon, Jan 11, 2021 at 12:49 PM Nikolay Shirokovskiy <
> nshirokovskiy@virtuozzo.com> wrote:
>
>> 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(-)
>>
>> --
>> 1.8.3.1
>>
>>