[PATCH 1/4] qemu: block: propagate the delete flag to where it can actually be used

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

 



Since the blockcommit operation is asynchronous, this has conceptually two
parts.  First, we have to propagate the flag from qemuDomainBlockCommit()
(which was just ignoring it until now) to qemuBlockJobDiskNewCommit().  Then
it can be stored in the qemuBlockJobCommitData structure which holds
information necessary to finish the job asynchronously.

Signed-off-by: Pavel Mores <pmores@xxxxxxxxxx>
---
 src/qemu/qemu_blockjob.c | 4 +++-
 src/qemu/qemu_blockjob.h | 4 +++-
 src/qemu/qemu_driver.c   | 5 +++--
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 5c294f8024..7d94a6ce38 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -250,7 +250,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;
@@ -273,6 +274,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 d8da918f2f..d77f1dcdb3 100644
--- a/src/qemu/qemu_blockjob.h
+++ b/src/qemu/qemu_blockjob.h
@@ -85,6 +85,7 @@ struct _qemuBlockJobCommitData {
     virStorageSourcePtr topparent;
     virStorageSourcePtr top;
     virStorageSourcePtr base;
+    bool deleteCommittedImages;
 };
 
 
@@ -165,7 +166,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 dc14ec86a3..75458f5c8a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18496,10 +18496,10 @@ qemuDomainBlockCommit(virDomainPtr dom,
     bool persistjob = false;
     bool blockdev = false;
 
-    /* XXX Add support for COMMIT_DELETE */
     virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW |
                   VIR_DOMAIN_BLOCK_COMMIT_ACTIVE |
                   VIR_DOMAIN_BLOCK_COMMIT_RELATIVE |
+                  VIR_DOMAIN_BLOCK_COMMIT_DELETE |
                   VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES, -1);
 
     if (!(vm = qemuDomainObjFromDomain(dom)))
@@ -18638,7 +18638,8 @@ qemuDomainBlockCommit(virDomainPtr dom,
         goto endjob;
 
     if (!(job = qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSource,
-                                          baseSource)))
+                                          baseSource,
+                                          flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE)))
         goto endjob;
 
     disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
-- 
2.21.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