[PATCH v3 6/7] virsh: Add mode option to domdirtyrate-calc virsh api

Hyman Huang huangy81 at chinatelecom.cn
Mon Feb 14 11:11:27 UTC 2022



在 2022/2/14 18:13, Michal Prívozník 写道:
> On 1/28/22 08:35, huangy81 at chinatelecom.cn wrote:
>> From: Hyman Huang(黄勇) <huangy81 at chinatelecom.cn>
>>
>> Extend domdirtyrate-calc virsh api with mode option, either
>> of these three options "page-sampling,dirty-bitmap,dirty-ring"
>> can be specified when calculating dirty page rate.
>>
>> Signed-off-by: Hyman Huang(黄勇) <huangy81 at chinatelecom.cn>
>> ---
>>   docs/manpages/virsh.rst |  7 +++++--
>>   src/libvirt-domain.c    | 12 +++++++++++-
>>   src/qemu/qemu_driver.c  | 24 +++++++++++++++++++++++-
>>   tools/virsh-domain.c    | 28 +++++++++++++++++++++++++++-
>>   4 files changed, 66 insertions(+), 5 deletions(-)
> 
> These changes need to be broken into smaller patches. Modifying virsh is
> one patch, qemu driver is the other.
> 
Ok.
>>
>> diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
>> index e28927e..e09703c 100644
>> --- a/docs/manpages/virsh.rst
>> +++ b/docs/manpages/virsh.rst
>> @@ -1714,13 +1714,16 @@ domdirtyrate-calc
>>   ::
>>   
>>      domdirtyrate-calc <domain> [--seconds <sec>]
>> +      [{--page-sampling | --dirty-bitmap | --dirty-ring}]
> 
> I'm wondering whether we should go with domdirtyrate-calc $dom
> --mode=[page-samling|dirty-bitmap|dirty-ring] instead. My reasoning is
> that it's more user friendly, IMO. But I don't have strong opinion, your
> version is good too.
> 
Indeed, these 3 modes are mutually exclusive, it's more sensible to use 
the  --mode=[page-samling|dirty-bitmap|dirty-ring]  instead.
I'll do the modification next verison.
>>   
>>   Calculate an active domain's memory dirty rate which may be expected by
>>   user in order to decide whether it's proper to be migrated out or not.
>>   The ``seconds`` parameter can be used to calculate dirty rate in a
>>   specific time which allows 60s at most now and would be default to 1s
>> -if missing. The calculated dirty rate information is available by calling
>> -'domstats --dirtyrate'.
>> +if missing. These three *--page-sampling, --dirty-bitmap, --dirty-ring*
>> +paremeters are mutually exclusive and used to specify calculation mode,
>> +*--page-sampling* is the default mode if missing. The calculated dirty
>> +rate information is available by calling 'domstats --dirtyrate'.
>>   
>>   
>>   domdisplay
>> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
>> index 5912551..4caa740 100644
>> --- a/src/libvirt-domain.c
>> +++ b/src/libvirt-domain.c
>> @@ -13298,7 +13298,7 @@ virDomainGetMessages(virDomainPtr domain,
>>    * virDomainStartDirtyRateCalc:
>>    * @domain: a domain object
>>    * @seconds: specified calculating time in seconds
>> - * @flags: extra flags; not used yet, so callers should always pass 0
>> + * @flags: bitwise-OR of supported virDomainDirtyRateCalcFlags
>>    *
>>    * Calculate the current domain's memory dirty rate in next @seconds





More information about the libvir-list mailing list