From: Nikolai Barybin via Devel <devel(a)lists.libvirt.org>
The snapshot creation/deletion QMP commands use the qemu 'job' API
to signal completion thus we need to add corresponding job types.
As the job handles everything internally we don't store anything about
the job.
Signed-off-by: Nikolai Barybin <nikolai.barybin(a)virtuozzo.com>
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_block.c | 2 ++
src/qemu/qemu_blockjob.c | 7 +++++++
src/qemu/qemu_blockjob.h | 2 ++
src/qemu/qemu_domain.c | 10 ++++++++++
4 files changed, 21 insertions(+)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 9bdec92697..e739c097ca 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3775,6 +3775,8 @@ qemuBlockPivot(virDomainObj *vm,
case QEMU_BLOCKJOB_TYPE_BACKUP:
case QEMU_BLOCKJOB_TYPE_INTERNAL:
case QEMU_BLOCKJOB_TYPE_CREATE:
+ case QEMU_BLOCKJOB_TYPE_SNAPSHOT_SAVE:
+ case QEMU_BLOCKJOB_TYPE_SNAPSHOT_DELETE:
case QEMU_BLOCKJOB_TYPE_BROKEN:
virReportError(VIR_ERR_OPERATION_INVALID,
_("job type '%1$s' does not support pivot"),
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 652b25540a..6e53603fba 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -68,6 +68,8 @@ VIR_ENUM_IMPL(qemuBlockjob,
"backup",
"",
"create",
+ "snapshot-save",
+ "snapshot-delete",
"broken");
static virClass *qemuBlockJobDataClass;
@@ -1455,6 +1457,11 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlockJobData *job,
progressTotal);
break;
+ case QEMU_BLOCKJOB_TYPE_SNAPSHOT_SAVE:
+ case QEMU_BLOCKJOB_TYPE_SNAPSHOT_DELETE:
+ /* The internal snapshot jobs don't need any extra handling */
+ break;
+
case QEMU_BLOCKJOB_TYPE_BROKEN:
case QEMU_BLOCKJOB_TYPE_NONE:
case QEMU_BLOCKJOB_TYPE_INTERNAL:
diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h
index f1ac43b4c7..6620e08c47 100644
--- a/src/qemu/qemu_blockjob.h
+++ b/src/qemu/qemu_blockjob.h
@@ -65,6 +65,8 @@ typedef enum {
/* Additional enum values local to qemu */
QEMU_BLOCKJOB_TYPE_INTERNAL,
QEMU_BLOCKJOB_TYPE_CREATE,
+ QEMU_BLOCKJOB_TYPE_SNAPSHOT_SAVE,
+ QEMU_BLOCKJOB_TYPE_SNAPSHOT_DELETE,
QEMU_BLOCKJOB_TYPE_BROKEN,
QEMU_BLOCKJOB_TYPE_LAST
} qemuBlockJobType;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b6762cc372..fc682c0c9d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2478,6 +2478,11 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload,
}
break;
+ case QEMU_BLOCKJOB_TYPE_SNAPSHOT_SAVE:
+ case QEMU_BLOCKJOB_TYPE_SNAPSHOT_DELETE:
+ /* No private data for internal snapshot jobs */
+ break;
+
case QEMU_BLOCKJOB_TYPE_BROKEN:
case QEMU_BLOCKJOB_TYPE_NONE:
case QEMU_BLOCKJOB_TYPE_INTERNAL:
@@ -3030,6 +3035,11 @@ qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qemuBlockJobData
*job,
goto broken;
break;
+ case QEMU_BLOCKJOB_TYPE_SNAPSHOT_SAVE:
+ case QEMU_BLOCKJOB_TYPE_SNAPSHOT_DELETE:
+ /* No extra data for internal snapshot jobs. */
+ break;
+
case QEMU_BLOCKJOB_TYPE_BROKEN:
case QEMU_BLOCKJOB_TYPE_NONE:
case QEMU_BLOCKJOB_TYPE_INTERNAL:
--
2.46.0