From: Hyman Huang(黄勇) <huangy81@xxxxxxxxxxxxxxx> Extend vcpuinfo api so that 'virsh vcpuinfo domain' can display dirtylimit info for active virtual cpu, which can be set by using 'virsh vcpudirtylimit'. Signed-off-by: Hyman Huang(黄勇) <huangy81@xxxxxxxxxxxxxxx> --- 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 dc5790f..9d6b66c 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -2891,6 +2891,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 f673fed..5fc1a61 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -2201,6 +2201,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 e6c18a4..874ce19 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 8705090..08fe259 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"); } -- 1.8.3.1