[PATCH Libvirt 07/11] virsh: Extend vcpuinfo api

~hyman posted 11 patches 2 years, 6 months ago
There is a newer version of this series
[PATCH Libvirt 07/11] virsh: Extend vcpuinfo api
Posted by ~hyman 3 years, 5 months ago
From: Hyman Huang(黄勇) <yong.huang@smartx.com>

Extend vcpuinfo api to display dirty page rate upper limit info,
which is set by 'limit-dirty-page-rate'.

Signed-off-by: Hyman Huang(黄勇) <yong.huang@smartx.com>
---
 src/remote/remote_daemon_dispatch.c | 2 ++
 src/remote/remote_driver.c          | 2 ++
 src/remote/remote_protocol.x        | 2 ++
 tools/virsh-domain.c                | 5 +++++
 4 files changed, 11 insertions(+)

diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index 7144e9e7ca..edf6386653 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -2893,6 +2893,8 @@ remoteDispatchDomainGetVcpus(virNetServer *server G_GNUC_UNUSED,
         ret->info.info_val[i].state = info[i].state;
         ret->info.info_val[i].cpu_time = info[i].cpuTime;
         ret->info.info_val[i].cpu = info[i].cpu;
+        ret->info.info_val[i].limit = info[i].limit;
+        ret->info.info_val[i].current = info[i].current;
     }
 
     /* Don't need to allocate/copy the cpumaps if we make the reasonable
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 4d7682eb32..c03e9e862b 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2147,6 +2147,8 @@ remoteDomainGetVcpus(virDomainPtr domain,
         info[i].state = ret.info.info_val[i].state;
         info[i].cpuTime = ret.info.info_val[i].cpu_time;
         info[i].cpu = ret.info.info_val[i].cpu;
+        info[i].limit = ret.info.info_val[i].limit;
+        info[i].current = ret.info.info_val[i].current;
     }
 
     for (i = 0; i < ret.cpumaps.cpumaps_len; ++i)
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index f0b7f0a5fa..633b9af74e 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -416,6 +416,8 @@ struct remote_vcpu_info {
     int state;
     unsigned hyper cpu_time;
     int cpu;
+    unsigned hyper limit;
+    unsigned hyper current;
 };
 
 /* Wire encoding of virTypedParameter.
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index ba2309eb3c..b51bd7a3d0 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6935,6 +6935,11 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
                                        maxcpu, pretty) < 0)
             return false;
 
+        if (cpuinfo[n].limit != 0) {
+            vshPrint(ctl, "%-15s %lld\n", _("DirtyRate limit:"), cpuinfo[n].limit);
+            vshPrint(ctl, "%-15s %lld\n", _("DirtyRate current:"), cpuinfo[n].current);
+        }
+
         if (n < (ncpus - 1))
             vshPrint(ctl, "\n");
     }
-- 
2.38.5
Re: [PATCH Libvirt 07/11] virsh: Extend vcpuinfo api
Posted by Peter Krempa 2 years, 6 months ago
On Sat, Aug 13, 2022 at 11:11:15 +0800, ~hyman wrote:
> From: Hyman Huang(黄勇) <yong.huang@smartx.com>
> 
> Extend vcpuinfo api to display dirty page rate upper limit info,
> which is set by 'limit-dirty-page-rate'.
> 
> Signed-off-by: Hyman Huang(黄勇) <yong.huang@smartx.com>
> ---
>  src/remote/remote_daemon_dispatch.c | 2 ++
>  src/remote/remote_driver.c          | 2 ++
>  src/remote/remote_protocol.x        | 2 ++
>  tools/virsh-domain.c                | 5 +++++
>  4 files changed, 11 insertions(+)
> diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
> index f0b7f0a5fa..633b9af74e 100644
> --- a/src/remote/remote_protocol.x
> +++ b/src/remote/remote_protocol.x
> @@ -416,6 +416,8 @@ struct remote_vcpu_info {
>      int state;
>      unsigned hyper cpu_time;
>      int cpu;
> +    unsigned hyper limit;
> +    unsigned hyper current;
>  };

NACK, see reasoning in 6/11