
On Sat, Aug 13, 2022 at 11:06:27 +0800, ~hyman wrote:
From: Hyman Huang(黄勇) <yong.huang@smartx.com>
Extend qemuDomainGetVcpus for getting dirty page rate upper limit info so 'virsh vcpuinfo' api can display it.
Signed-off-by: Hyman Huang(黄勇) <yong.huang@smartx.com> --- include/libvirt/libvirt-domain.h | 2 ++ src/qemu/qemu_driver.c | 55 ++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index df7deffaa9..4c63d0be7c 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -2395,6 +2395,8 @@ struct _virVcpuInfo { int state; /* value from virVcpuState */ unsigned long long cpuTime; /* CPU time used, in nanoseconds */ int cpu; /* real CPU number, or one of the values from virVcpuHostCpuState */ + unsigned long long limit; /* virtual cpu dirty page rate upper limit in MB/s */ + unsigned long long current; /* current virtual cpu dirty page rate in MB/s */ };
Adding fields to C structs makes them ABI (binary) incompatible with programs compiled with libvirt before this change. Same goes for the RPC protocol. Thus we must never add to existing structs. I suggest you use the bulk stats API (virConnectGetAllDomainStats/virDomainListGetStats) which is extensible. NACK to this patch.