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