Propagate the delete flag from qemuDomainBlockCommit() (which was just
ignoring it until now) to qemuBlockJobDiskNewCommit() where it can be
stored in the qemuBlockJobCommitData structure which holds information
necessary to finish the job asynchronously.
In the actual qemuBlockJobDiskNewCommit() in this commit, we temporarily
pass a literal 'false' to preserve the current behaviour until the whole
implementation of the feature is in place.
Signed-off-by: Pavel Mores <pmores(a)redhat.com>
---
src/qemu/qemu_blockjob.c | 4 +++-
src/qemu/qemu_blockjob.h | 4 +++-
src/qemu/qemu_driver.c | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 81aa46c2fb..718e311213 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -282,7 +282,8 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
virDomainDiskDefPtr disk,
virStorageSourcePtr topparent,
virStorageSourcePtr top,
- virStorageSourcePtr base)
+ virStorageSourcePtr base,
+ bool delete_imgs)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
g_autoptr(qemuBlockJobData) job = NULL;
@@ -305,6 +306,7 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
job->data.commit.topparent = topparent;
job->data.commit.top = top;
job->data.commit.base = base;
+ job->data.commit.deleteCommittedImages = delete_imgs;
if (qemuBlockJobRegister(job, vm, disk, true) < 0)
return NULL;
diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h
index 52b03aaf9e..42b973fe96 100644
--- a/src/qemu/qemu_blockjob.h
+++ b/src/qemu/qemu_blockjob.h
@@ -87,6 +87,7 @@ struct _qemuBlockJobCommitData {
virStorageSourcePtr topparent;
virStorageSourcePtr top;
virStorageSourcePtr base;
+ bool deleteCommittedImages;
};
@@ -180,7 +181,8 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
virDomainDiskDefPtr disk,
virStorageSourcePtr topparent,
virStorageSourcePtr top,
- virStorageSourcePtr base);
+ virStorageSourcePtr base,
+ bool delete_imgs);
qemuBlockJobDataPtr
qemuBlockJobNewCreate(virDomainObjPtr vm,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9197dffadd..9c07b6b393 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18686,7 +18686,7 @@ qemuDomainBlockCommit(virDomainPtr dom,
goto endjob;
if (!(job = qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSource,
- baseSource)))
+ baseSource, false)))
goto endjob;
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
--
2.21.0