[libvirt] [PATCH v2 RFC 05/12] backup: misc: add backup block job type

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Fri May 12 13:37:21 UTC 2017


---
 examples/object-events/event-test.c | 3 +++
 include/libvirt/libvirt-domain.h    | 3 +++
 src/conf/domain_conf.c              | 2 +-
 src/qemu/qemu_monitor_json.c        | 2 ++
 tools/virsh-domain.c                | 3 ++-
 5 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c
index 12690ca..592df09 100644
--- a/examples/object-events/event-test.c
+++ b/examples/object-events/event-test.c
@@ -877,6 +877,9 @@ blockJobTypeToStr(int type)
 
     case VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT:
         return "active layer block commit";
+
+    case VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP:
+        return "block backup";
     }
 
     return "unknown";
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index c9e96a6..1501405 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -2325,6 +2325,9 @@ typedef enum {
     /* Active Block Commit (virDomainBlockCommit with flags), job
      * exists as long as sync is active */
 
+    VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP = 5,
+    /* Block Backup */
+
 # ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_BLOCK_JOB_TYPE_LAST
 # endif
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0ff216e..5179527 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -863,7 +863,7 @@ VIR_ENUM_IMPL(virDomainLoader,
  * <mirror> XML (remaining types are not two-phase). */
 VIR_ENUM_DECL(virDomainBlockJob)
 VIR_ENUM_IMPL(virDomainBlockJob, VIR_DOMAIN_BLOCK_JOB_TYPE_LAST,
-              "", "", "copy", "", "active-commit")
+              "", "", "copy", "", "active-commit", "")
 
 VIR_ENUM_IMPL(virDomainMemoryModel,
               VIR_DOMAIN_MEMORY_MODEL_LAST,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index b3446ee..5ca0b19 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -885,6 +885,8 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon,
         type = VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT;
     else if (STREQ(type_str, "mirror"))
         type = VIR_DOMAIN_BLOCK_JOB_TYPE_COPY;
+    else if (STREQ(type_str, "backup"))
+        type = VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP;
 
     switch ((virConnectDomainEventBlockJobStatus) event) {
     case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 0d19d0e..d18e1f9 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2454,7 +2454,8 @@ VIR_ENUM_IMPL(virshDomainBlockJob,
               N_("Block Pull"),
               N_("Block Copy"),
               N_("Block Commit"),
-              N_("Active Block Commit"))
+              N_("Active Block Commit"),
+              N_("Block Backup"))
 
 static const char *
 virshDomainBlockJobToString(int type)
-- 
1.8.3.1




More information about the libvir-list mailing list