Re: [PATCH v7 0/7] migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2021-03-18 Thread Hao Wang
Sure. I'll post NEWS.rst information soon, and really appreciate your help!

Best Regards,
Hao

On 2021/3/18 15:49, Michal Privoznik wrote:
> On 3/16/21 1:32 PM, Hao Wang wrote:
>> Hao Wang (7):
>>    migration/dirtyrate: Introduce virDomainStartDirtyRateCalc API
>>    migration/dirtyrate: Implement qemuDomainStartDirtyRateCalc
>>    migration/dirtyrate: Introduce domdirtyrate-calc virsh api
>>    migration/dirtyrate: Introduce virDomainDirtyRateStatus enum
>>    migration/dirtyrate: Implement qemuMonitorQueryDirtyRate
>>    migration/dirtyrate: Extend dirtyrate statistics for domGetStats
>>    migration/dirtyrate: Introduce command 'virsh domstats --dirtyrate'
>>
>>   docs/manpages/virsh.rst  |  33 +-
>>   include/libvirt/libvirt-domain.h |  23 +++
>>   src/driver-hypervisor.h  |   6 ++
>>   src/libvirt-domain.c |  59 +
>>   src/libvirt_public.syms  |   5 ++
>>   src/qemu/qemu_driver.c   | 110 +++
>>   src/qemu/qemu_monitor.c  |  24 +++
>>   src/qemu/qemu_monitor.h  |  19 +
>>   src/qemu/qemu_monitor_json.c | 101 
>>   src/qemu/qemu_monitor_json.h |   8 +++
>>   src/remote/remote_driver.c   |   1 +
>>   src/remote/remote_protocol.x |  14 +++-
>>   src/remote_protocol-structs  |   6 ++
>>   tools/virsh-domain-monitor.c |   7 ++
>>   tools/virsh-domain.c |  58 
>>   15 files changed, 471 insertions(+), 3 deletions(-)
>>
> 
> Looks good to me.
> 
> Reviewed-by: Michal Privoznik 
> 
> Will push shortly. Can you please post a follow up patch that adds NEWS.rst 
> entry? I think this deserves to be mention in release notes.
> 
> Michal
> 
> .




Re: [PATCH v7 0/7] migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2021-03-18 Thread Michal Privoznik

On 3/16/21 1:32 PM, Hao Wang wrote:

V6 -> V7:
add virDomainDirtyRateStatus enum
define calc_status as int
split 5/5 in v6 into two parts:
 6/7 in v7: extend dirtyrate statistics for domGetStats
 7/7 in v7: extend corresponding virsh command

V5 -> V6:
split DomainGetDirtyRateInfo(domdirtyrate) API into two parts:
 1. DomainStartDirtyRateCalc(domdirtyrate-calc) for starting dirty rate
calculation;
 2. qemuDomainGetStatsDirtyRate(domstats --dirtyrate) for querying dirty
rate infomation.

V4 -> V5:
squash 1/7 and bits of 5/7 and 6/7 into 2/7 in v4 (to be 1/5 in v5)
squash left of 5/7 into 4/7 in v4 (to be 3/5 in v5)
add VIR_DOMAIN_DIRTYRATE_DEFAULT flag
remove redundant error report
rename virsh api to "domdirtyrate"
use vshTablePtr for virsh api output
add description in docs/manpages/virsh.rst
other format optimize

V3 -> V4:
define flags to unsigned int
fix some compile warnings

V2 -> V3:
reorganize patchset to fix compile warning

V1 -> V2:
replace QEMU_JOB_ASYNC with QEMU_JOB_QUERY


Sometimes domain's memory dirty rate is expected by user in order to
decide whether it's proper to be migrated out or not.

We have already completed the QEMU part of the capability:
https://patchew.org/QEMU/1600237327-33618-1-git-send-email-zhengch...@huawei.com/
And this serial of patches introduce the corresponding LIBVIRT part:

1. Calculating
Introduce a new API DomainStartDirtyRateCalc and corresponding virsh api
(domdirtyrate-calc) for starting dirty rate calculation by calling qmp
'calc-dirty-rate'.

# virsh domdirtyrate-calc  [--seconds ]

2. Querying
Introduce command 'virsh domstats --dirtyrate' for reporting memory
dirty rate infomation by calling qmp 'query-dirty-rate'.

The info is listed as:
Domain: 'vm0'
   dirtyrate.calc_status=2
   dirtyrate.calc_start_time=1534523
   dirtyrate.calc_period=1
   dirtyrate.megabytes_per_second=5


Hao Wang (7):
   migration/dirtyrate: Introduce virDomainStartDirtyRateCalc API
   migration/dirtyrate: Implement qemuDomainStartDirtyRateCalc
   migration/dirtyrate: Introduce domdirtyrate-calc virsh api
   migration/dirtyrate: Introduce virDomainDirtyRateStatus enum
   migration/dirtyrate: Implement qemuMonitorQueryDirtyRate
   migration/dirtyrate: Extend dirtyrate statistics for domGetStats
   migration/dirtyrate: Introduce command 'virsh domstats --dirtyrate'

  docs/manpages/virsh.rst  |  33 +-
  include/libvirt/libvirt-domain.h |  23 +++
  src/driver-hypervisor.h  |   6 ++
  src/libvirt-domain.c |  59 +
  src/libvirt_public.syms  |   5 ++
  src/qemu/qemu_driver.c   | 110 +++
  src/qemu/qemu_monitor.c  |  24 +++
  src/qemu/qemu_monitor.h  |  19 ++
  src/qemu/qemu_monitor_json.c | 101 
  src/qemu/qemu_monitor_json.h |   8 +++
  src/remote/remote_driver.c   |   1 +
  src/remote/remote_protocol.x |  14 +++-
  src/remote_protocol-structs  |   6 ++
  tools/virsh-domain-monitor.c |   7 ++
  tools/virsh-domain.c |  58 
  15 files changed, 471 insertions(+), 3 deletions(-)



Looks good to me.

Reviewed-by: Michal Privoznik 

Will push shortly. Can you please post a follow up patch that adds 
NEWS.rst entry? I think this deserves to be mention in release notes.


Michal



[PATCH v7 0/7] migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2021-03-16 Thread Hao Wang
V6 -> V7:
add virDomainDirtyRateStatus enum
define calc_status as int
split 5/5 in v6 into two parts:
6/7 in v7: extend dirtyrate statistics for domGetStats
7/7 in v7: extend corresponding virsh command

V5 -> V6:
split DomainGetDirtyRateInfo(domdirtyrate) API into two parts:
1. DomainStartDirtyRateCalc(domdirtyrate-calc) for starting dirty rate
   calculation;
2. qemuDomainGetStatsDirtyRate(domstats --dirtyrate) for querying dirty
   rate infomation.

V4 -> V5:
squash 1/7 and bits of 5/7 and 6/7 into 2/7 in v4 (to be 1/5 in v5)
squash left of 5/7 into 4/7 in v4 (to be 3/5 in v5)
add VIR_DOMAIN_DIRTYRATE_DEFAULT flag
remove redundant error report
rename virsh api to "domdirtyrate"
use vshTablePtr for virsh api output
add description in docs/manpages/virsh.rst
other format optimize

V3 -> V4:
define flags to unsigned int
fix some compile warnings

V2 -> V3:
reorganize patchset to fix compile warning

V1 -> V2:
replace QEMU_JOB_ASYNC with QEMU_JOB_QUERY


Sometimes domain's memory dirty rate is expected by user in order to
decide whether it's proper to be migrated out or not.

We have already completed the QEMU part of the capability:
https://patchew.org/QEMU/1600237327-33618-1-git-send-email-zhengch...@huawei.com/
And this serial of patches introduce the corresponding LIBVIRT part:

1. Calculating
Introduce a new API DomainStartDirtyRateCalc and corresponding virsh api
(domdirtyrate-calc) for starting dirty rate calculation by calling qmp
'calc-dirty-rate'.

# virsh domdirtyrate-calc  [--seconds ]

2. Querying
Introduce command 'virsh domstats --dirtyrate' for reporting memory
dirty rate infomation by calling qmp 'query-dirty-rate'.

The info is listed as:
Domain: 'vm0'
  dirtyrate.calc_status=2
  dirtyrate.calc_start_time=1534523
  dirtyrate.calc_period=1
  dirtyrate.megabytes_per_second=5


Hao Wang (7):
  migration/dirtyrate: Introduce virDomainStartDirtyRateCalc API
  migration/dirtyrate: Implement qemuDomainStartDirtyRateCalc
  migration/dirtyrate: Introduce domdirtyrate-calc virsh api
  migration/dirtyrate: Introduce virDomainDirtyRateStatus enum
  migration/dirtyrate: Implement qemuMonitorQueryDirtyRate
  migration/dirtyrate: Extend dirtyrate statistics for domGetStats
  migration/dirtyrate: Introduce command 'virsh domstats --dirtyrate'

 docs/manpages/virsh.rst  |  33 +-
 include/libvirt/libvirt-domain.h |  23 +++
 src/driver-hypervisor.h  |   6 ++
 src/libvirt-domain.c |  59 +
 src/libvirt_public.syms  |   5 ++
 src/qemu/qemu_driver.c   | 110 +++
 src/qemu/qemu_monitor.c  |  24 +++
 src/qemu/qemu_monitor.h  |  19 ++
 src/qemu/qemu_monitor_json.c | 101 
 src/qemu/qemu_monitor_json.h |   8 +++
 src/remote/remote_driver.c   |   1 +
 src/remote/remote_protocol.x |  14 +++-
 src/remote_protocol-structs  |   6 ++
 tools/virsh-domain-monitor.c |   7 ++
 tools/virsh-domain.c |  58 
 15 files changed, 471 insertions(+), 3 deletions(-)

-- 
2.23.0




Re: [PATCH v6 0/5] migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2021-03-04 Thread Hao Wang
Great thanks for your reviewing!
I will update 5/5 and possibly 4/5 according to expected more suggestion in the 
next version.

BR,
Hao

On 2021/3/3 19:31, Michal Privoznik wrote:
> On 2/26/21 9:35 AM, Hao Wang wrote:
>>
>> Hao Wang (5):
>>    migration/dirtyrate: Introduce virDomainStartDirtyRateCalc API
>>    migration/dirtyrate: Implement qemuDomainStartDirtyRateCalc
>>    migration/dirtyrate: Introduce domdirtyrate-calc virsh api
>>    migration/dirtyrate: Implement qemuMonitorQueryDirtyRate
>>    migration/dirtyrate: Introduce command 'virsh domstats --dirtyrate'
>>
>>   docs/manpages/virsh.rst  |  33 -
>>   include/libvirt/libvirt-domain.h |   5 ++
>>   src/driver-hypervisor.h  |   6 ++
>>   src/libvirt-domain.c |  57 +++
>>   src/libvirt_public.syms  |   5 ++
>>   src/qemu/qemu_driver.c   | 115 +++
>>   src/qemu/qemu_monitor.c  |  24 +++
>>   src/qemu/qemu_monitor.h  |  18 +
>>   src/qemu/qemu_monitor_json.c |  88 +++
>>   src/qemu/qemu_monitor_json.h |   8 +++
>>   src/remote/remote_driver.c   |   1 +
>>   src/remote/remote_protocol.x |  14 +++-
>>   src/remote_protocol-structs  |   6 ++
>>   tools/virsh-domain-monitor.c |   7 ++
>>   tools/virsh-domain.c |  63 +
>>   15 files changed, 447 insertions(+), 3 deletions(-)
>>
> 
> To patches 1-4:
> 
> Reviewed-by: Michal Privoznik 
> 
> The last one 5/5 should be split. And I'd wait for others to give opinion on 
> the enum vs string representation of calc_status. If we go with enum, then I 
> think _qemuMonitorDirtyRateInfo struct in 4/5 should be updated to reflect 
> this change.
> 
> We are almost there!
> 
> Michal
> 
> .




Re: [PATCH v6 0/5] migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2021-03-03 Thread Michal Privoznik

On 2/26/21 9:35 AM, Hao Wang wrote:

V5 -> V6:
split DomainGetDirtyRateInfo(domdirtyrate) API into two parts:
 1. DomainStartDirtyRateCalc(domdirtyrate-calc) for starting dirty rate
calculation;
 2. qemuDomainGetStatsDirtyRate(domstats --dirtyrate) for querying dirty
rate infomation.

V4 -> V5:
squash 1/7 and bits of 5/7 and 6/7 into 2/7 in v4 (to be 1/5 in v5)
squash left of 5/7 into 4/7 in v4 (to be 3/5 in v5)
add VIR_DOMAIN_DIRTYRATE_DEFAULT flag
remove redundant error report
rename virsh api to "domdirtyrate"
use vshTablePtr for virsh api output
add description in docs/manpages/virsh.rst
other format optimize

V3 -> V4:
define flags to unsigned int
fix some compile warnings

V2 -> V3:
reorganize patchset to fix compile warning

V1 -> V2:
replace QEMU_JOB_ASYNC with QEMU_JOB_QUERY


Sometimes domain's memory dirty rate is expected by user in order to
decide whether it's proper to be migrated out or not.

We have already completed the QEMU part of the capability:
https://patchew.org/QEMU/1600237327-33618-1-git-send-email-zhengch...@huawei.com/
And this serial of patches introduce the corresponding LIBVIRT part:

1. Calculating
Introduce a new API DomainStartDirtyRateCalc and corresponding virsh api
(domdirtyrate-calc) for starting dirty rate calculation by calling qmp
'calc-dirty-rate'.

# virsh domdirtyrate-calc  [--seconds ]

2. Querying
Introduce command 'virsh domstats --dirtyrate' for reporting memory
dirty rate infomation by calling qmp 'query-dirty-rate'.

The info is listed as:
Domain: 'vm0'
   dirtyrate.calc_status=measured
   dirtyrate.calc_start_time=502814
   dirtyrate.calc_period=1
   dirtyrate.megabytes_per_second=2


Hao Wang (5):
   migration/dirtyrate: Introduce virDomainStartDirtyRateCalc API
   migration/dirtyrate: Implement qemuDomainStartDirtyRateCalc
   migration/dirtyrate: Introduce domdirtyrate-calc virsh api
   migration/dirtyrate: Implement qemuMonitorQueryDirtyRate
   migration/dirtyrate: Introduce command 'virsh domstats --dirtyrate'

  docs/manpages/virsh.rst  |  33 -
  include/libvirt/libvirt-domain.h |   5 ++
  src/driver-hypervisor.h  |   6 ++
  src/libvirt-domain.c |  57 +++
  src/libvirt_public.syms  |   5 ++
  src/qemu/qemu_driver.c   | 115 +++
  src/qemu/qemu_monitor.c  |  24 +++
  src/qemu/qemu_monitor.h  |  18 +
  src/qemu/qemu_monitor_json.c |  88 +++
  src/qemu/qemu_monitor_json.h |   8 +++
  src/remote/remote_driver.c   |   1 +
  src/remote/remote_protocol.x |  14 +++-
  src/remote_protocol-structs  |   6 ++
  tools/virsh-domain-monitor.c |   7 ++
  tools/virsh-domain.c |  63 +
  15 files changed, 447 insertions(+), 3 deletions(-)



To patches 1-4:

Reviewed-by: Michal Privoznik 

The last one 5/5 should be split. And I'd wait for others to give 
opinion on the enum vs string representation of calc_status. If we go 
with enum, then I think _qemuMonitorDirtyRateInfo struct in 4/5 should 
be updated to reflect this change.


We are almost there!

Michal



[PATCH v6 0/5] migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2021-02-26 Thread Hao Wang
V5 -> V6:
split DomainGetDirtyRateInfo(domdirtyrate) API into two parts:
1. DomainStartDirtyRateCalc(domdirtyrate-calc) for starting dirty rate
   calculation;
2. qemuDomainGetStatsDirtyRate(domstats --dirtyrate) for querying dirty
   rate infomation.

V4 -> V5:
squash 1/7 and bits of 5/7 and 6/7 into 2/7 in v4 (to be 1/5 in v5)
squash left of 5/7 into 4/7 in v4 (to be 3/5 in v5)
add VIR_DOMAIN_DIRTYRATE_DEFAULT flag
remove redundant error report
rename virsh api to "domdirtyrate"
use vshTablePtr for virsh api output
add description in docs/manpages/virsh.rst
other format optimize

V3 -> V4:
define flags to unsigned int
fix some compile warnings

V2 -> V3:
reorganize patchset to fix compile warning

V1 -> V2:
replace QEMU_JOB_ASYNC with QEMU_JOB_QUERY


Sometimes domain's memory dirty rate is expected by user in order to
decide whether it's proper to be migrated out or not.

We have already completed the QEMU part of the capability:
https://patchew.org/QEMU/1600237327-33618-1-git-send-email-zhengch...@huawei.com/
And this serial of patches introduce the corresponding LIBVIRT part:

1. Calculating
Introduce a new API DomainStartDirtyRateCalc and corresponding virsh api
(domdirtyrate-calc) for starting dirty rate calculation by calling qmp
'calc-dirty-rate'.

# virsh domdirtyrate-calc  [--seconds ]

2. Querying
Introduce command 'virsh domstats --dirtyrate' for reporting memory
dirty rate infomation by calling qmp 'query-dirty-rate'.

The info is listed as:
Domain: 'vm0'
  dirtyrate.calc_status=measured
  dirtyrate.calc_start_time=502814
  dirtyrate.calc_period=1
  dirtyrate.megabytes_per_second=2


Hao Wang (5):
  migration/dirtyrate: Introduce virDomainStartDirtyRateCalc API
  migration/dirtyrate: Implement qemuDomainStartDirtyRateCalc
  migration/dirtyrate: Introduce domdirtyrate-calc virsh api
  migration/dirtyrate: Implement qemuMonitorQueryDirtyRate
  migration/dirtyrate: Introduce command 'virsh domstats --dirtyrate'

 docs/manpages/virsh.rst  |  33 -
 include/libvirt/libvirt-domain.h |   5 ++
 src/driver-hypervisor.h  |   6 ++
 src/libvirt-domain.c |  57 +++
 src/libvirt_public.syms  |   5 ++
 src/qemu/qemu_driver.c   | 115 +++
 src/qemu/qemu_monitor.c  |  24 +++
 src/qemu/qemu_monitor.h  |  18 +
 src/qemu/qemu_monitor_json.c |  88 +++
 src/qemu/qemu_monitor_json.h |   8 +++
 src/remote/remote_driver.c   |   1 +
 src/remote/remote_protocol.x |  14 +++-
 src/remote_protocol-structs  |   6 ++
 tools/virsh-domain-monitor.c |   7 ++
 tools/virsh-domain.c |  63 +
 15 files changed, 447 insertions(+), 3 deletions(-)

-- 
2.23.0




[PATCH v5 0/5] migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2021-02-01 Thread Hao Wang
V4 -> V5:
squash 1/7 and bits of 5/7 and 6/7 into 2/7 in v4 (to be 1/5 in v5)
squash left of 5/7 into 4/7 in v4 (to be 3/5 in v5)
add VIR_DOMAIN_DIRTYRATE_DEFAULT flag
remove redundant error report
rename virsh api to "domdirtyrate"
use vshTablePtr for virsh api output
add description in docs/manpages/virsh.rst
other format optimize
 
V3 -> V4:
define flags to unsigned int
fix some compile warnings

V2 -> V3:
reorganize patchset to fix compile warning

V1 -> V2:
replace QEMU_JOB_ASYNC with QEMU_JOB_QUERY


Sometimes domain's memory dirty rate is expected by user in order to
decide whether it's proper to be migrated out or not.

We have already completed the QEMU part of the capability:
https://patchew.org/QEMU/1600237327-33618-1-git-send-email-zhengch...@huawei.com/
And this serial of patches introduce the corresponding LIBVIRT part --
DomainGetDirtyRateInfo API and corresponding virsh api -- "domdirtyrate".


instructions:
bash# virsh domdirtyrate --help
  NAME
domdirtyrate - Get a vm's memory dirty rate

  SYNOPSIS
domdirtyrate  [--seconds ] [--calculate] [--query]

  DESCRIPTION
Get memory dirty rate of a domain in order to decide whether it's proper to 
be migrated out or not.

  OPTIONS
[--domain]   domain name, id or uuid
--seconds   calculate memory dirty rate within specified seconds, 
the supported value range is [1, 60], default to 1s.
--calculate  calculate dirty rate only, can be used together with 
--query, either or both is expected, otherwise would default to both.
--query  query dirty rate only, can be used together with 
--calculate, either or both is expected, otherwise would default to both.

example:
bash# virsh domdirtyrate vm0 --calculate --query --seconds 1
 Item  Value
-
 Status:   measured
 Start time:   51585
 Calculate time:   1 s
 Dirty rate:   18 MB/s


Hao Wang (5):
  migration/dirtyrate: Introduce DomainGetDirtyRateInfo API
  migration/dirtyrate: Implement qemuDomainCalculateDirtyRate
  migration/dirtyrate: Implement qemuDomainQueryDirtyRate
  migration/dirtyrate: Implement qemuDomainGetDirtyRateInfo
  migration/dirtyrate: Introduce domdirtyrate virsh api

 docs/manpages/virsh.rst  |  17 +
 include/libvirt/libvirt-domain.h |  59 ++
 src/driver-hypervisor.h  |   7 ++
 src/libvirt-domain.c |  56 ++
 src/libvirt_public.syms  |   5 ++
 src/qemu/qemu_driver.c   |  67 
 src/qemu/qemu_migration.c|  48 
 src/qemu/qemu_migration.h|  10 +++
 src/qemu/qemu_monitor.c  |  24 ++
 src/qemu/qemu_monitor.h  |   8 ++
 src/qemu/qemu_monitor_json.c |  99 
 src/qemu/qemu_monitor_json.h |   8 ++
 src/remote/remote_driver.c   |   1 +
 src/remote/remote_protocol.x |  21 -
 tools/virsh-domain.c | 127 +++
 15 files changed, 556 insertions(+), 1 deletion(-)

-- 
2.23.0




Re: [PATCH v4 0/7] migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2021-01-25 Thread Hao Wang
Yes, and sorry for reply late. I'll try to upload v5 in a week.

BR,
Hao

On 2021/1/25 18:40, Michal Privoznik wrote:
> On 11/7/20 10:41 AM, Hao Wang wrote:
>>
> 
> Hey, any plans on v5?
> 
> Michal
> 
> .



Re: [PATCH v4 0/7] migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2021-01-25 Thread Michal Privoznik

On 11/7/20 10:41 AM, Hao Wang wrote:
>

Hey, any plans on v5?

Michal



Re: [PATCH v4 0/7] migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2020-11-09 Thread Hao Wang
I quite agree with you and will modify that in my next realeases. Thanks for 
your suggestion!


On 2020/11/10 9:34, Han Han wrote:
> 
> 
> On Sat, Nov 7, 2020 at 5:54 PM Hao Wang  > wrote:
> 
> V3 -> V4:
> define flags to unsigned int
> fix some compile warnings
> 
> V2 -> V3:
> reorganize patchset to fix compile warning
> 
> V1 -> V2:
> replace QEMU_JOB_ASYNC with QEMU_JOB_QUERY
> 
> 
> Sometimes domain's memory dirty rate is expected by user in order to
> decide whether it's proper to be migrated out or not.
> 
> We have already completed the QEMU part of the capability:
> 
> https://patchew.org/QEMU/1600237327-33618-1-git-send-email-zhengch...@huawei.com/
> And this serial of patches introduce the corresponding LIBVIRT part --
> DomainGetDirtyRateInfo API and corresponding virsh api -- "getdirtyrate".
> 
> 
> instructions:
> bash# virsh getdirtyrate --help
>   NAME
>     getdirtyrate - Get a vm's memory dirty rate
> 
> I think it is better to name the virsh cmd as 'domgetdirtyrate' or 
> 'domdirtyrate' because
> the most of virsh cmds for getting the info of VM have the prefix dom.
> 




Re: [PATCH v4 0/7] migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2020-11-09 Thread Han Han
On Sat, Nov 7, 2020 at 5:54 PM Hao Wang  wrote:

> V3 -> V4:
> define flags to unsigned int
> fix some compile warnings
>
> V2 -> V3:
> reorganize patchset to fix compile warning
>
> V1 -> V2:
> replace QEMU_JOB_ASYNC with QEMU_JOB_QUERY
>
>
> Sometimes domain's memory dirty rate is expected by user in order to
> decide whether it's proper to be migrated out or not.
>
> We have already completed the QEMU part of the capability:
>
> https://patchew.org/QEMU/1600237327-33618-1-git-send-email-zhengch...@huawei.com/
> And this serial of patches introduce the corresponding LIBVIRT part --
> DomainGetDirtyRateInfo API and corresponding virsh api -- "getdirtyrate".
>
>
> instructions:
> bash# virsh getdirtyrate --help
>   NAME
> getdirtyrate - Get a vm's memory dirty rate
>
I think it is better to name the virsh cmd as 'domgetdirtyrate' or
'domdirtyrate' because
the most of virsh cmds for getting the info of VM have the prefix dom.

>
>   SYNOPSIS
> getdirtyrate  [--seconds ] [--calculate] [--query]
>
>   DESCRIPTION
> Get memory dirty rate of a domain in order to decide whether it's
> proper to be migrated out or not.
>
>   OPTIONS
> [--domain]   domain name, id or uuid
> --seconds   calculate memory dirty rate within specified
> seconds, a valid range of values is [1, 60], and would default to 1s.
> --calculate  calculate dirty rate only, can be used together with
> --query, either or both is expected, otherwise would default to both.
> --query  query dirty rate only, can be used together with
> --calculate, either or both is expected, otherwise would default to both.
>
>
> example:
> bash# virsh getdirtyrate --calculate --query --domain vm0 --seconds 1
> status:measured
> startTime: 820148
> calcTime:  1 s
> dirtyRate: 6 MB/s
>
>
> *** BLURB HERE ***
>
> Hao Wang (7):
>   migration/dirtyrate: Introduce virDomainDirtyRateInfo structure
>   migration/dirtyrate: set up framwork of domainGetDirtyRateInfo API
>   migration/dirtyrate: Implement qemuDomainCalculateDirtyRate
>   migration/dirtyrate: Implement qemuDomainQueryDirtyRate
>   migration/dirtyrate: Implement qemuMonitorJSONExtractDirtyRateInfo
>   migration/dirtyrate: Implement qemuDomainGetDirtyRateInfo
>   migration/dirtyrate: Introduce getdirtyrate virsh api
>
>  include/libvirt/libvirt-domain.h |  57 
>  src/driver-hypervisor.h  |   7 ++
>  src/libvirt-domain.c |  46 +
>  src/libvirt_public.syms  |   5 ++
>  src/qemu/qemu_driver.c   |  68 +++
>  src/qemu/qemu_migration.c|  59 
>  src/qemu/qemu_migration.h|  10 +++
>  src/qemu/qemu_monitor.c  |  24 +++
>  src/qemu/qemu_monitor.h  |   8 +++
>  src/qemu/qemu_monitor_json.c |  97 ++
>  src/qemu/qemu_monitor_json.h |   8 +++
>  src/remote/remote_driver.c   |   1 +
>  src/remote/remote_protocol.x |  21 +-
>  tools/virsh-domain.c | 112 +++
>  14 files changed, 522 insertions(+), 1 deletion(-)
>
> --
> 2.23.0
>
>
>


[PATCH v4 0/7] migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2020-11-07 Thread Hao Wang
V3 -> V4:
define flags to unsigned int
fix some compile warnings

V2 -> V3:
reorganize patchset to fix compile warning

V1 -> V2:
replace QEMU_JOB_ASYNC with QEMU_JOB_QUERY


Sometimes domain's memory dirty rate is expected by user in order to
decide whether it's proper to be migrated out or not.

We have already completed the QEMU part of the capability:
https://patchew.org/QEMU/1600237327-33618-1-git-send-email-zhengch...@huawei.com/
And this serial of patches introduce the corresponding LIBVIRT part --
DomainGetDirtyRateInfo API and corresponding virsh api -- "getdirtyrate".


instructions:
bash# virsh getdirtyrate --help
  NAME
getdirtyrate - Get a vm's memory dirty rate

  SYNOPSIS
getdirtyrate  [--seconds ] [--calculate] [--query]

  DESCRIPTION
Get memory dirty rate of a domain in order to decide whether it's proper to 
be migrated out or not.

  OPTIONS
[--domain]   domain name, id or uuid
--seconds   calculate memory dirty rate within specified seconds, a 
valid range of values is [1, 60], and would default to 1s.
--calculate  calculate dirty rate only, can be used together with 
--query, either or both is expected, otherwise would default to both.
--query  query dirty rate only, can be used together with 
--calculate, either or both is expected, otherwise would default to both.


example:
bash# virsh getdirtyrate --calculate --query --domain vm0 --seconds 1
status:measured
startTime: 820148
calcTime:  1 s
dirtyRate: 6 MB/s


*** BLURB HERE ***

Hao Wang (7):
  migration/dirtyrate: Introduce virDomainDirtyRateInfo structure
  migration/dirtyrate: set up framwork of domainGetDirtyRateInfo API
  migration/dirtyrate: Implement qemuDomainCalculateDirtyRate
  migration/dirtyrate: Implement qemuDomainQueryDirtyRate
  migration/dirtyrate: Implement qemuMonitorJSONExtractDirtyRateInfo
  migration/dirtyrate: Implement qemuDomainGetDirtyRateInfo
  migration/dirtyrate: Introduce getdirtyrate virsh api

 include/libvirt/libvirt-domain.h |  57 
 src/driver-hypervisor.h  |   7 ++
 src/libvirt-domain.c |  46 +
 src/libvirt_public.syms  |   5 ++
 src/qemu/qemu_driver.c   |  68 +++
 src/qemu/qemu_migration.c|  59 
 src/qemu/qemu_migration.h|  10 +++
 src/qemu/qemu_monitor.c  |  24 +++
 src/qemu/qemu_monitor.h  |   8 +++
 src/qemu/qemu_monitor_json.c |  97 ++
 src/qemu/qemu_monitor_json.h |   8 +++
 src/remote/remote_driver.c   |   1 +
 src/remote/remote_protocol.x |  21 +-
 tools/virsh-domain.c | 112 +++
 14 files changed, 522 insertions(+), 1 deletion(-)

-- 
2.23.0




migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2020-10-27 Thread Hao Wang
V2 -> V3:
reorganize patchset to fix compile warning

V1 -> V2:
replace QEMU_JOB_ASYNC with QEMU_JOB_QUERY


Sometimes domain's memory dirty rate is expected by user in order to
decide whether it's proper to be migrated out or not.

We have already completed the QEMU part of the capability:
https://patchew.org/QEMU/1600237327-33618-1-git-send-email-zhengch...@huawei.com/
And this serial of patches introduce the corresponding LIBVIRT part --
DomainGetDirtyRateInfo API and corresponding virsh api -- "getdirtyrate".


instructions:
bash# virsh getdirtyrate --help
  NAME
getdirtyrate - Get a vm's memory dirty rate

  SYNOPSIS
getdirtyrate  [--seconds ] [--calculate] [--query]

  DESCRIPTION
Get memory dirty rate of a domain in order to decide whether it's proper to 
be migrated out or not.

  OPTIONS
[--domain]   domain name, id or uuid
--seconds   calculate memory dirty rate within specified seconds, a 
valid range of values is [1, 60], and would default to 1s.
--calculate  calculate dirty rate only, can be used together with 
--query, either or both is expected, otherwise would default to both.
--query  query dirty rate only, can be used together with 
--calculate, either or both is expected, otherwise would default to both.


example:
bash# virsh getdirtyrate --calculate --query --domain vm0 --seconds 1
status:measured
startTime: 820148
calcTime:  1 s
dirtyRate: 6 MB/s

Hao Wang (7):
  migration/dirtyrate: Introduce virDomainDirtyRateInfo structure
  migration/dirtyrate: set up framwork of domainGetDirtyRateInfo API
  migration/dirtyrate: Implement qemuDomainGetDirtyRateInfo
  migration/dirtyrate: Implement qemuDomainCalculateDirtyRate
  migration/dirtyrate: Implement qemuDomainCalculateDirtyRate
  migration/dirtyrate: Implement qemuMonitorJSONExtractDirtyRateInfo
  migration/dirtyrate: Introduce getdirtyrate virsh api

 include/libvirt/libvirt-domain.h |  56 
 src/driver-hypervisor.h  |   7 ++
 src/libvirt-domain.c |  46 +
 src/libvirt_public.syms  |   5 ++
 src/qemu/qemu_driver.c   |  67 ++
 src/qemu/qemu_migration.c|  59 
 src/qemu/qemu_migration.h|  10 +++
 src/qemu/qemu_monitor.c  |  24 +++
 src/qemu/qemu_monitor.h  |   8 +++
 src/qemu/qemu_monitor_json.c |  97 ++
 src/qemu/qemu_monitor_json.h |   8 +++
 src/remote/remote_driver.c   |   1 +
 src/remote/remote_protocol.x |  21 +-
 tools/virsh-domain.c | 112 +++
 14 files changed, 520 insertions(+), 1 deletion(-)

-- 
2.23.0




[PATCH v2 0/7] migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2020-10-19 Thread Hao Wang
V1 -> V2:
replace QEMU_JOB_ASYNC with QEMU_JOB_QUERY


Sometimes domain's memory dirty rate is expected by user in order to
decide whether it's proper to be migrated out or not.

We have already completed the QEMU part of the capability:
https://patchew.org/QEMU/1600237327-33618-1-git-send-email-zhengch...@huawei.com/
And this serial of patches introduce the corresponding LIBVIRT part --
DomainGetDirtyRateInfo API and corresponding virsh api -- "getdirtyrate".


instructions:
bash# virsh getdirtyrate --help
  NAME
getdirtyrate - Get a vm's memory dirty rate

  SYNOPSIS
getdirtyrate  [--seconds ] [--calculate] [--query]

  DESCRIPTION
Get memory dirty rate of a domain in order to decide whether it's proper to 
be migrated out or not.

  OPTIONS
[--domain]   domain name, id or uuid
--seconds   calculate memory dirty rate within specified seconds, a 
valid range of values is [1, 60], and would default to 1s.
--calculate  calculate dirty rate only, can be used together with 
--query, either or both is expected, otherwise would default to both.
--query  query dirty rate only, can be used together with 
--calculate, either or both is expected, otherwise would default to both.


example:
bash# virsh getdirtyrate --calculate --query --domain vm0 --seconds 1
status:measured
startTime: 820148
calcTime:  1 s
dirtyRate: 6 MB/s


Hao Wang (7):
  migration/dirtyrate: Introduce virDomainDirtyRateInfo structure
  migration/dirtyrate: Implement qemuMonitorJSONExtractDirtyRateInfo
  migration/dirtyrate: Implement qemuDomainQueryDirtyRate
  migration/dirtyrate: Implement qemuDomainCalculateDirtyRate
  migration/dirtyrate: Introduce virDomainDirtyRateFlags
  migration/dirtyrate: Introduce DomainGetDirtyRateInfo API
  migration/dirtyrate: Introduce getdirtyrate virsh api

 include/libvirt/libvirt-domain.h |  64 ++
 src/driver-hypervisor.h  |   7 ++
 src/libvirt-domain.c |  46 +
 src/libvirt_public.syms  |   5 ++
 src/qemu/qemu_driver.c   |  70 +++
 src/qemu/qemu_migration.c|  59 
 src/qemu/qemu_migration.h|  10 +++
 src/qemu/qemu_monitor.c  |  24 +++
 src/qemu/qemu_monitor.h  |   8 +++
 src/qemu/qemu_monitor_json.c |  97 ++
 src/qemu/qemu_monitor_json.h |   8 +++
 src/remote/remote_driver.c   |   1 +
 src/remote/remote_protocol.x |  21 +-
 tools/virsh-domain.c | 112 +++
 14 files changed, 531 insertions(+), 1 deletion(-)

-- 
2.23.0




[[RESEND] 0/8] migration/dirtyrate: Introduce APIs for getting domain memory dirty rate

2020-10-15 Thread Hao Wang
Sometimes domain's memory dirty rate is expected by user in order to
decide whether it's proper to be migrated out or not.

We have already completed the QEMU part of the capability:
https://patchew.org/QEMU/1600237327-33618-1-git-send-email-zhengch...@huawei.com/
And this serial of patches introduce the corresponding LIBVIRT part --
DomainGetDirtyRateInfo API and corresponding virsh api -- "getdirtyrate".


instructions:
bash# virsh getdirtyrate --help
  NAME
getdirtyrate - Get a vm's memory dirty rate

  SYNOPSIS
getdirtyrate  [--seconds ] [--calculate] [--query]

  DESCRIPTION
Get memory dirty rate of a domain in order to decide whether it's proper to 
be migrated out or not.

  OPTIONS
[--domain]   domain name, id or uuid
--seconds   calculate memory dirty rate within specified seconds, a 
valid range of values is [1, 60], and would default to 1s.
--calculate  calculate dirty rate only, can be used together with 
--query, either or both is expected, otherwise would default to both.
--query  query dirty rate only, can be used together with 
--calculate, either or both is expected, otherwise would default to both.


example:
bash# virsh getdirtyrate --calculate --query --domain vm0 --seconds 1
status:measured
startTime: 820148
calcTime:  1 s
dirtyRate: 6 MB/s


Hao Wang (8):
  migration/dirtyrate: Introduce virDomainDirtyRateInfo structure
  migration/dirtyrate: Implement qemuMonitorJSONExtractDirtyRateInfo
  migration/dirtyrate: Introduce dirty_rate async job
  migration/dirtyrate: Implement qemuDomainQueryDirtyRate
  migration/dirtyrate: Implement qemuDomainCalculateDirtyRate
  migration/dirtyrate: Introduce virDomainDirtyRateFlags
  migration/dirtyrate: Introduce DomainGetDirtyRateInfo API
  migration/dirtyrate: Introduce getdirtyrate virsh api

 include/libvirt/libvirt-domain.h |  65 ++
 src/driver-hypervisor.h  |   7 ++
 src/libvirt-domain.c |  46 +
 src/libvirt_public.syms  |   5 ++
 src/qemu/qemu_domainjob.c|   3 +
 src/qemu/qemu_domainjob.h|   1 +
 src/qemu/qemu_driver.c   |  76 +
 src/qemu/qemu_migration.c|  63 +
 src/qemu/qemu_migration.h|  10 +++
 src/qemu/qemu_monitor.c  |  24 +++
 src/qemu/qemu_monitor.h  |   8 +++
 src/qemu/qemu_monitor_json.c |  97 ++
 src/qemu/qemu_monitor_json.h |   8 +++
 src/qemu/qemu_process.c  |   3 +
 src/remote/remote_driver.c   |   1 +
 src/remote/remote_protocol.x |  21 +-
 tools/virsh-domain.c | 113 +++
 17 files changed, 550 insertions(+), 1 deletion(-)

-- 
2.23.0