Re: [PATCH v6 1/5] migration/dirtyrate: Introduce virDomainStartDirtyRateCalc API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/26/21 9:35 AM, Hao Wang wrote:
Introduce virDomainStartDirtyRateCalc API for start calculation of
a domain's memory dirty rate with a specified time.

Signed-off-by: Hao Wang <wanghao232@xxxxxxxxxx>
---
  include/libvirt/libvirt-domain.h |  4 +++
  src/driver-hypervisor.h          |  6 +++++
  src/libvirt-domain.c             | 44 ++++++++++++++++++++++++++++++++
  src/libvirt_public.syms          |  5 ++++
  src/remote/remote_driver.c       |  1 +
  src/remote/remote_protocol.x     | 14 +++++++++-
  src/remote_protocol-structs      |  6 +++++
  7 files changed, 79 insertions(+), 1 deletion(-)


diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 4af0166872..b1cc2ebbf3 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -13154,3 +13154,47 @@ virDomainGetMessages(virDomainPtr domain,
      virDispatchError(conn);
      return -1;
  }
+
+
+/**
+ * virDomainStartDirtyRateCalc:
+ * @domain: a domain object
+ * @seconds: specified calculating time in seconds
+ * @flags: extra flags; not used yet, so callers should always pass 0
+ *
+ * Calculate the current domain's memory dirty rate in next @seconds.
+ * The calculated dirty rate infomation is available by calling

information

+ * virConnectGetAllDomainStats.
+ *
+ * Returns 0 in case of success, -1 otherwise.
+ */
+int
+virDomainStartDirtyRateCalc(virDomainPtr domain,
+                            int seconds,
+                            unsigned int flags)
+{
+    virConnectPtr conn;
+
+    VIR_DOMAIN_DEBUG(domain, "seconds=%d, flags=0x%x", seconds, flags);
+
+    virResetLastError();
+
+    virCheckDomainReturn(domain, -1);
+    conn = domain->conn;
+
+    virCheckReadOnlyGoto(conn->flags, error);
+
+    if (conn->driver->domainStartDirtyRateCalc) {
+        int ret;
+        ret = conn->driver->domainStartDirtyRateCalc(domain, seconds, flags);
+        if (ret < 0)
+            goto error;
+        return ret;
+    }
+
+    virReportUnsupportedError();
+
+ error:
+    virDispatchError(conn);
+    return -1;
+}

Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux