[PATCH 11/21] Add 'backup' block job type

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

 



A backup job may consist of many backup sub-blockjobs. Add the new
blockjob type and add all type converter strings.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 examples/c/misc/event-test.c     | 3 +++
 include/libvirt/libvirt-domain.h | 3 +++
 src/conf/domain_conf.c           | 2 +-
 src/qemu/qemu_blockjob.c         | 3 +++
 src/qemu/qemu_blockjob.h         | 1 +
 src/qemu/qemu_domain.c           | 4 ++++
 src/qemu/qemu_driver.c           | 1 +
 src/qemu/qemu_monitor_json.c     | 4 ++++
 tools/virsh-domain.c             | 4 +++-
 9 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/examples/c/misc/event-test.c b/examples/c/misc/event-test.c
index 5db572175d..ae282a5027 100644
--- a/examples/c/misc/event-test.c
+++ b/examples/c/misc/event-test.c
@@ -891,6 +891,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 "backup";
     }

     return "unknown";
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 5fe431c152..8136a8d031 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -2446,6 +2446,9 @@ typedef enum {
      * exists as long as sync is active */
     VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT = 4,

+    /* Backup (virDomainBackupBegin), job exists until virDomainBackupEnd */
+    VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP = 5,
+
 # 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 9580884747..78436a89a2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1227,7 +1227,7 @@ VIR_ENUM_IMPL(virDomainOsDefFirmware,
 VIR_ENUM_DECL(virDomainBlockJob);
 VIR_ENUM_IMPL(virDomainBlockJob,
               VIR_DOMAIN_BLOCK_JOB_TYPE_LAST,
-              "", "", "copy", "", "active-commit",
+              "", "", "copy", "", "active-commit", "",
 );

 VIR_ENUM_IMPL(virDomainMemoryModel,
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 2c51367c67..eafad0432c 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -65,6 +65,7 @@ VIR_ENUM_IMPL(qemuBlockjob,
               "copy",
               "commit",
               "active-commit",
+              "backup",
               "",
               "create",
               "broken");
@@ -1275,6 +1276,8 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
             qemuBlockJobProcessEventConcludedCopyAbort(driver, vm, job, asyncJob);
         break;

+    case QEMU_BLOCKJOB_TYPE_BACKUP:
+        break;

     case QEMU_BLOCKJOB_TYPE_BROKEN:
     case QEMU_BLOCKJOB_TYPE_NONE:
diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h
index fdfe2c57ec..4734984c99 100644
--- a/src/qemu/qemu_blockjob.h
+++ b/src/qemu/qemu_blockjob.h
@@ -60,6 +60,7 @@ typedef enum {
     QEMU_BLOCKJOB_TYPE_COPY = VIR_DOMAIN_BLOCK_JOB_TYPE_COPY,
     QEMU_BLOCKJOB_TYPE_COMMIT = VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT,
     QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT = VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT,
+    QEMU_BLOCKJOB_TYPE_BACKUP = VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP,
     /* Additional enum values local to qemu */
     QEMU_BLOCKJOB_TYPE_INTERNAL,
     QEMU_BLOCKJOB_TYPE_CREATE,
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 436b8d331b..344601c8d6 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2603,6 +2603,8 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload,
                 virBufferAddLit(&attrBuf, " shallownew='yes'");
             break;

+        case QEMU_BLOCKJOB_TYPE_BACKUP:
+            break;

         case QEMU_BLOCKJOB_TYPE_BROKEN:
         case QEMU_BLOCKJOB_TYPE_NONE:
@@ -3169,6 +3171,8 @@ qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qemuBlockJobDataPtr job,
             }
             break;

+        case QEMU_BLOCKJOB_TYPE_BACKUP:
+            break;

         case QEMU_BLOCKJOB_TYPE_BROKEN:
         case QEMU_BLOCKJOB_TYPE_NONE:
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5956f51f17..b955c3efe1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17421,6 +17421,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,

     case QEMU_BLOCKJOB_TYPE_PULL:
     case QEMU_BLOCKJOB_TYPE_COMMIT:
+    case QEMU_BLOCKJOB_TYPE_BACKUP:
     case QEMU_BLOCKJOB_TYPE_INTERNAL:
     case QEMU_BLOCKJOB_TYPE_CREATE:
     case QEMU_BLOCKJOB_TYPE_BROKEN:
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 9f3783ab70..391f39668a 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -1147,6 +1147,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:
@@ -4844,6 +4846,8 @@ qemuMonitorJSONParseBlockJobInfo(virHashTablePtr blockJobs,
         info->type = VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT;
     else if (STREQ(type, "mirror"))
         info->type = VIR_DOMAIN_BLOCK_JOB_TYPE_COPY;
+    else if (STREQ(type, "backup"))
+        info->type = VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP;
     else
         info->type = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN;

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 45af0b1427..51ba573819 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2550,7 +2550,9 @@ VIR_ENUM_IMPL(virshDomainBlockJob,
               N_("Block Pull"),
               N_("Block Copy"),
               N_("Block Commit"),
-              N_("Active Block Commit"));
+              N_("Active Block Commit"),
+              N_("Backup"),
+);

 static const char *
 virshDomainBlockJobToString(int type)
-- 
2.23.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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