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(a)redhat.com>
---
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 6d1c7f1a3b..f40096af88 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) */
+ 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 baa79ea80c..5455eaba65 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");
@@ -1276,6 +1277,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 4c8ffd60b0..980287d2a0 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 3ebc902d4f..913ab18812 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17427,6 +17427,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 5c313279d7..b009e4bfcc 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