]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
migration/dirtyrate: Introduce command 'virsh domstats --dirtyrate'
authorHao Wang <wanghao232@huawei.com>
Tue, 16 Mar 2021 12:32:51 +0000 (20:32 +0800)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 18 Mar 2021 07:50:25 +0000 (08:50 +0100)
Introduce command 'virsh domstats --dirtyrate' for reporting memory
dirty rate information. The info is listed as:

Domain: 'vm0'
  dirtyrate.calc_status=2
  dirtyrate.calc_start_time=1534523
  dirtyrate.calc_period=1
  dirtyrate.megabytes_per_second=5

Signed-off-by: Hao Wang <wanghao232@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
docs/manpages/virsh.rst
tools/virsh-domain-monitor.c

index 367b4bddeba47f73b3f364e984f89b1cedfceb42..813fb0bd60dce684009337997ce66deecf6bd139 100644 (file)
@@ -2219,7 +2219,7 @@ domstats
 
    domstats [--raw] [--enforce] [--backing] [--nowait] [--state]
       [--cpu-total] [--balloon] [--vcpu] [--interface]
-      [--block] [--perf] [--iothread] [--memory]
+      [--block] [--perf] [--iothread] [--memory] [--dirtyrate]
       [[--list-active] [--list-inactive]
        [--list-persistent] [--list-transient] [--list-running]y
        [--list-paused] [--list-shutoff] [--list-other]] | [domain ...]
@@ -2238,7 +2238,8 @@ behavior use the *--raw* flag.
 The individual statistics groups are selectable via specific flags. By
 default all supported statistics groups are returned. Supported
 statistics groups flags are: *--state*, *--cpu-total*, *--balloon*,
-*--vcpu*, *--interface*, *--block*, *--perf*, *--iothread*, *--memory*.
+*--vcpu*, *--interface*, *--block*, *--perf*, *--iothread*, *--memory*,
+*--dirtyrate*.
 
 Note that - depending on the hypervisor type and version or the domain state
 - not all of the following statistics may be returned.
@@ -2435,6 +2436,17 @@ not available for statistical purposes.
   bytes consumed by @vcpus that passing through all memory controllers, either
   local or remote controller.
 
+*--dirtyrate* returns:
+
+* ``dirtyrate.calc_status`` - the status of last memory dirty rate
+  calculation, returned as number from virDomainDirtyRateStatus enum.
+* ``dirtyrate.calc_start_time`` - the start time of last memory dirty
+  rate calculation.
+* ``dirtyrate.calc_period`` - the period of last memory dirty rate
+  calculation.
+* ``dirtyrate.megabytes_per_second`` - the calculated memory dirty
+  rate in MiB/s.
+
 
 Selecting a specific statistics groups doesn't guarantee that the
 daemon supports the selected group of stats. Flag *--enforce*
index 897339b6f9cd46129a259f83ce93d7dd6f3a44c5..c4d74646955835e5da2ed0988499ab7047bef237 100644 (file)
@@ -2148,6 +2148,10 @@ static const vshCmdOptDef opts_domstats[] = {
      .type = VSH_OT_BOOL,
      .help = N_("report domain memory usage"),
     },
+    {.name = "dirtyrate",
+     .type = VSH_OT_BOOL,
+     .help = N_("report domain dirty rate information"),
+    },
     {.name = "list-active",
      .type = VSH_OT_BOOL,
      .help = N_("list only active domains"),
@@ -2267,6 +2271,9 @@ cmdDomstats(vshControl *ctl, const vshCmd *cmd)
     if (vshCommandOptBool(cmd, "memory"))
         stats |= VIR_DOMAIN_STATS_MEMORY;
 
+    if (vshCommandOptBool(cmd, "dirtyrate"))
+        stats |= VIR_DOMAIN_STATS_DIRTYRATE;
+
     if (vshCommandOptBool(cmd, "list-active"))
         flags |= VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE;