[libvirt PATCH 09/30] qemu_block: introduce qemuBlockFinalize

Pavel Hrdina posted 30 patches 3 years, 2 months ago
There is a newer version of this series
[libvirt PATCH 09/30] qemu_block: introduce qemuBlockFinalize
Posted by Pavel Hrdina 3 years, 2 months ago
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 src/qemu/qemu_block.c | 19 +++++++++++++++++++
 src/qemu/qemu_block.h |  5 +++++
 2 files changed, 24 insertions(+)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 2abddf904f..24c82377b0 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3509,3 +3509,22 @@ qemuBlockPivot(virDomainObj *vm,
 
     return ret;
 }
+
+
+int
+qemuBlockFinalize(virDomainObj *vm,
+                  qemuBlockJobData *job,
+                  virDomainAsyncJob asyncJob)
+{
+    int ret;
+    qemuDomainObjPrivate *priv = vm->privateData;
+
+    if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0)
+        return -1;
+
+    ret = qemuMonitorJobFinalize(priv->mon, job->name);
+
+    qemuDomainObjExitMonitor(vm);
+
+    return ret;
+}
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index 7b6aec2a7d..c169432d9c 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -293,3 +293,8 @@ qemuBlockPivot(virDomainObj *vm,
                qemuBlockJobData *job,
                virDomainAsyncJob asyncJob,
                virDomainDiskDef *disk);
+
+int
+qemuBlockFinalize(virDomainObj *vm,
+                  qemuBlockJobData *job,
+                  virDomainAsyncJob asyncJob);
-- 
2.38.1
Re: [libvirt PATCH 09/30] qemu_block: introduce qemuBlockFinalize
Posted by Peter Krempa 3 years, 1 month ago
On Thu, Dec 08, 2022 at 14:30:45 +0100, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  src/qemu/qemu_block.c | 19 +++++++++++++++++++
>  src/qemu/qemu_block.h |  5 +++++
>  2 files changed, 24 insertions(+)
> 
> diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
> index 2abddf904f..24c82377b0 100644
> --- a/src/qemu/qemu_block.c
> +++ b/src/qemu/qemu_block.c
> @@ -3509,3 +3509,22 @@ qemuBlockPivot(virDomainObj *vm,
>  
>      return ret;
>  }
> +
> +

While at the monitor level it's quite obvious here please add a comment
and describe what the finalization step actually is and how it's
supposed to be used.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>