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-zhengchuan@xxxxxxxxxx/ 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 <domain> [--seconds <number>] [--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] <string> domain name, id or uuid --seconds <number> 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