[[RESEND] 3/8] migration/dirtyrate: Introduce dirty_rate async job

Hao Wang posted 1 patch 1 week ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20201015074946.2740968-4-wanghao232@huawei.com
include/libvirt/libvirt-domain.h | 1 +
src/qemu/qemu_domainjob.c        | 3 +++
src/qemu/qemu_domainjob.h        | 1 +
src/qemu/qemu_driver.c           | 5 +++++
src/qemu/qemu_migration.c        | 2 ++
src/qemu/qemu_process.c          | 3 +++
tools/virsh-domain.c             | 1 +
7 files changed, 16 insertions(+)

[[RESEND] 3/8] migration/dirtyrate: Introduce dirty_rate async job

Posted by Hao Wang 1 week ago
Introduce dirty_rate async job for qemuDomainGetDirtyRateInfo.

Signed-off-by: Hao Wang <wanghao232@huawei.com>
Reviewed-by: Chuan Zheng <zhengchuan@huawei.com>
---
 include/libvirt/libvirt-domain.h | 1 +
 src/qemu/qemu_domainjob.c        | 3 +++
 src/qemu/qemu_domainjob.h        | 1 +
 src/qemu/qemu_driver.c           | 5 +++++
 src/qemu/qemu_migration.c        | 2 ++
 src/qemu/qemu_process.c          | 3 +++
 tools/virsh-domain.c             | 1 +
 7 files changed, 16 insertions(+)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 9bf4f8a8cf..c7c64b9317 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -3308,6 +3308,7 @@ typedef enum {
     VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT = 7,
     VIR_DOMAIN_JOB_OPERATION_DUMP = 8,
     VIR_DOMAIN_JOB_OPERATION_BACKUP = 9,
+    VIR_DOMAIN_JOB_OPERATION_DIRTYRATE = 10,
 
 # ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_JOB_OPERATION_LAST
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index 3c2c6b9179..d20cc09d49 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -61,6 +61,7 @@ VIR_ENUM_IMPL(qemuDomainAsyncJob,
               "snapshot",
               "start",
               "backup",
+              "dirty rate"
 );
 
 const char *
@@ -78,6 +79,7 @@ qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
     case QEMU_ASYNC_JOB_START:
     case QEMU_ASYNC_JOB_NONE:
     case QEMU_ASYNC_JOB_BACKUP:
+    case QEMU_ASYNC_JOB_DIRTYRATE:
         G_GNUC_FALLTHROUGH;
     case QEMU_ASYNC_JOB_LAST:
         break;
@@ -104,6 +106,7 @@ qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
     case QEMU_ASYNC_JOB_START:
     case QEMU_ASYNC_JOB_NONE:
     case QEMU_ASYNC_JOB_BACKUP:
+    case QEMU_ASYNC_JOB_DIRTYRATE:
         G_GNUC_FALLTHROUGH;
     case QEMU_ASYNC_JOB_LAST:
         break;
diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h
index 79f0127252..4f820aaf37 100644
--- a/src/qemu/qemu_domainjob.h
+++ b/src/qemu/qemu_domainjob.h
@@ -74,6 +74,7 @@ typedef enum {
     QEMU_ASYNC_JOB_SNAPSHOT,
     QEMU_ASYNC_JOB_START,
     QEMU_ASYNC_JOB_BACKUP,
+    QEMU_ASYNC_JOB_DIRTYRATE,
 
     QEMU_ASYNC_JOB_LAST
 } qemuDomainAsyncJob;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 825bdd9119..8457cbfb4b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12856,6 +12856,11 @@ static int qemuDomainAbortJob(virDomainPtr dom)
         ret = 0;
         break;
 
+    case QEMU_ASYNC_JOB_DIRTYRATE:
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("cannot abort get dirty rate"));
+        break;
+
     case QEMU_ASYNC_JOB_LAST:
     default:
         virReportEnumRangeError(qemuDomainAsyncJob, priv->job.asyncJob);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 4e959abebf..3e4ca49df0 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1643,6 +1643,8 @@ qemuMigrationJobName(virDomainObjPtr vm)
         return _("start job");
     case QEMU_ASYNC_JOB_BACKUP:
         return _("backup job");
+    case QEMU_ASYNC_JOB_DIRTYRATE:
+        return _("dirty rate");
     case QEMU_ASYNC_JOB_LAST:
     default:
         return _("job");
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 5bc76a75e3..74b98cd72b 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3687,6 +3687,9 @@ qemuProcessRecoverJob(virQEMUDriverPtr driver,
         priv->job.current->started = now;
         break;
 
+    case QEMU_ASYNC_JOB_DIRTYRATE:
+        break;
+
     case QEMU_ASYNC_JOB_NONE:
     case QEMU_ASYNC_JOB_LAST:
         break;
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 8f11393197..909864c940 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6166,6 +6166,7 @@ VIR_ENUM_IMPL(virshDomainJobOperation,
               N_("Snapshot revert"),
               N_("Dump"),
               N_("Backup"),
+              N_("Dirty Rate"),
 );
 
 static const char *
-- 
2.23.0