Re: [PATCH 08/12] qemu: Add length for bps/iops throttling parameters to driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23.09.2016 14:56, John Ferlan wrote:
> Add support for a duration/length for the bps/iops and friends.
> 
> Modify the API in order to add the "blkdeviotune." specific definitions
> for the iotune throttling duration/length options
> 
>     total_bytes_sec_max_length
>     write_bytes_sec_max_length
>     read_bytes_sec_max_length
>     total_iops_sec_max_length
>     write_iops_sec_max_length
>     read_iops_sec_max_length
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  include/libvirt/libvirt-domain.h |  54 ++++++++++++++++++++
>  src/conf/domain_conf.h           |   6 +++
>  src/qemu/qemu_driver.c           | 106 ++++++++++++++++++++++++++++++++++++++-
>  src/qemu/qemu_monitor.c          |   7 ++-
>  src/qemu/qemu_monitor.h          |   3 +-
>  src/qemu/qemu_monitor_json.c     |  25 ++++++++-
>  src/qemu/qemu_monitor_json.h     |   3 +-
>  tests/qemumonitorjsontest.c      |  17 ++++++-
>  8 files changed, 211 insertions(+), 10 deletions(-)
> 

> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index ee16cb5..3b04754 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -113,7 +113,8 @@ VIR_LOG_INIT("qemu.qemu_driver");
>  #define QEMU_NB_MEM_PARAM  3
>  
>  #define QEMU_NB_BLOCK_IO_TUNE_PARAM  6
> -#define QEMU_NB_BLOCK_IO_TUNE_PARAM_MAX  13
> +#define QEMU_NB_BLOCK_IO_TUNE_PARAM_LENGTH 12
> +#define QEMU_NB_BLOCK_IO_TUNE_PARAM_MAX  19
>  
>  #define QEMU_NB_NUMA_PARAM 2
>  
> @@ -17262,7 +17263,10 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
>      bool set_bytes_max = false;
>      bool set_iops_max = false;
>      bool set_size_iops = false;
> +    bool set_bytes_max_length = false;
> +    bool set_iops_max_length = false;
>      bool supportMaxOptions = true;
> +    bool supportMaxLengthOptions = true;
>      virQEMUDriverConfigPtr cfg = NULL;
>      virObjectEventPtr event = NULL;
>      virTypedParameterPtr eventParams = NULL;
> @@ -17298,6 +17302,18 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
>                                 VIR_TYPED_PARAM_ULLONG,
>                                 VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC,
>                                 VIR_TYPED_PARAM_ULLONG,
> +                               VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGTH,
> +                               VIR_TYPED_PARAM_ULLONG,
> +                               VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTH,
> +                               VIR_TYPED_PARAM_ULLONG,
> +                               VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGTH,
> +                               VIR_TYPED_PARAM_ULLONG,
> +                               VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTH,
> +                               VIR_TYPED_PARAM_ULLONG,
> +                               VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTH,
> +                               VIR_TYPED_PARAM_ULLONG,
> +                               VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH,
> +                               VIR_TYPED_PARAM_ULLONG,
>                                 NULL) < 0)
>          return -1;
>  
> @@ -17449,6 +17465,60 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
>                                          VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC,
>                                          param->value.ul) < 0)
>                  goto endjob;
> +        } else if (STREQ(param->field,
> +                         VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGTH)) {
> +            info.total_bytes_sec_max_length = param->value.ul;
> +            set_bytes_max_length = true;
> +            if (virTypedParamsAddULLong(&eventParams, &eventNparams,
> +                                        &eventMaxparams,
> +                                        VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX_LENGTH,
> +                                        param->value.ul) < 0)
> +                goto endjob;
> +        } else if (STREQ(param->field,
> +                         VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTH)) {
> +            info.read_bytes_sec_max_length = param->value.ul;
> +            set_bytes_max_length = true;
> +            if (virTypedParamsAddULLong(&eventParams, &eventNparams,
> +                                        &eventMaxparams,
> +                                        VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX_LENGTH,
> +                                        param->value.ul) < 0)
> +                goto endjob;
> +        } else if (STREQ(param->field,
> +                         VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGTH)) {
> +            info.write_bytes_sec_max_length = param->value.ul;
> +            set_bytes_max_length = true;
> +            if (virTypedParamsAddULLong(&eventParams, &eventNparams,
> +                                        &eventMaxparams,
> +                                        VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX_LENGTH,
> +                                        param->value.ul) < 0)
> +                goto endjob;
> +        } else if (STREQ(param->field,
> +                         VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTH)) {
> +            info.total_iops_sec_max_length = param->value.ul;
> +            set_iops_max_length = true;
> +            if (virTypedParamsAddULLong(&eventParams, &eventNparams,
> +                                        &eventMaxparams,
> +                                        VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX_LENGTH,
> +                                        param->value.ul) < 0)
> +                goto endjob;
> +        } else if (STREQ(param->field,
> +                         VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTH)) {
> +            info.read_iops_sec_max_length = param->value.ul;
> +            set_iops_max_length = true;
> +            if (virTypedParamsAddULLong(&eventParams, &eventNparams,
> +                                        &eventMaxparams,
> +                                        VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX_LENGTH,
> +                                        param->value.ul) < 0)
> +                goto endjob;
> +        } else if (STREQ(param->field,
> +                         VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH)) {
> +            info.write_iops_sec_max_length = param->value.ul;
> +            set_iops_max_length = true;
> +            if (virTypedParamsAddULLong(&eventParams, &eventNparams,
> +                                        &eventMaxparams,
> +                                        VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX_LENGTH,
> +                                        param->value.ul) < 0)
> +                goto endjob;

I wonder if we could turn these into something more readable. But that's
something for a different patch set.

>          }
>      }

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]