[PATCH 01/31] qemu: domain: Identify blockjobs by storage nodename in VM status XML

Peter Krempa posted 31 patches 2 years, 3 months ago
[PATCH 01/31] qemu: domain: Identify blockjobs by storage nodename in VM status XML
Posted by Peter Krempa 2 years, 3 months ago
Use the node name of the storage access driver to identify the block job
volumes. This will prepare the blockjob code to the possibility that the
format layer may be missing. Our lookup code can find either of them,
thus we can safely switch.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_domain.c                               |  8 ++++----
 tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml | 12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index eec7bed28b..918b5a14e1 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2288,13 +2288,13 @@ qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobData *job,
     g_auto(virBuffer) disabledBitmapsBuf = VIR_BUFFER_INIT_CHILD(buf);

     if (job->data.commit.base)
-        virBufferAsprintf(buf, "<base node='%s'/>\n", job->data.commit.base->nodeformat);
+        virBufferAsprintf(buf, "<base node='%s'/>\n", job->data.commit.base->nodestorage);

     if (job->data.commit.top)
-        virBufferAsprintf(buf, "<top node='%s'/>\n", job->data.commit.top->nodeformat);
+        virBufferAsprintf(buf, "<top node='%s'/>\n", job->data.commit.top->nodestorage);

     if (job->data.commit.topparent)
-        virBufferAsprintf(buf, "<topparent node='%s'/>\n", job->data.commit.topparent->nodeformat);
+        virBufferAsprintf(buf, "<topparent node='%s'/>\n", job->data.commit.topparent->nodestorage);

     if (job->data.commit.deleteCommittedImages)
         virBufferAddLit(buf, "<deleteCommittedImages/>\n");
@@ -2357,7 +2357,7 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload,
     switch ((qemuBlockJobType) job->type) {
         case QEMU_BLOCKJOB_TYPE_PULL:
             if (job->data.pull.base)
-                virBufferAsprintf(&childBuf, "<base node='%s'/>\n", job->data.pull.base->nodeformat);
+                virBufferAsprintf(&childBuf, "<base node='%s'/>\n", job->data.pull.base->nodestorage);
             break;

         case QEMU_BLOCKJOB_TYPE_COMMIT:
diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
index b62b3149c2..380ef053d2 100644
--- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
+++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
@@ -238,14 +238,14 @@
     <blockjob name='broken-test' type='broken' state='ready' brokentype='commit'/>
     <blockjob name='commit-vdc-libvirt-9-format' type='commit' state='running' jobflags='0x0'>
       <disk dst='vdc'/>
-      <base node='libvirt-11-format'/>
-      <top node='libvirt-9-format'/>
-      <topparent node='libvirt-2-format'/>
+      <base node='libvirt-11-storage'/>
+      <top node='libvirt-9-storage'/>
+      <topparent node='libvirt-2-storage'/>
     </blockjob>
     <blockjob name='commit-vde-libvirt-17-format' type='active-commit' state='ready'>
       <disk dst='vde'/>
-      <base node='libvirt-19-format'/>
-      <top node='libvirt-17-format'/>
+      <base node='libvirt-19-storage'/>
+      <top node='libvirt-17-storage'/>
       <deleteCommittedImages/>
     </blockjob>
     <blockjob name='copy-vdd-libvirt-4321-format' type='copy' state='ready' jobflags='0x0' shallownew='yes'>
@@ -301,7 +301,7 @@
     </blockjob>
     <blockjob name='pull-vdb-libvirt-3-format' type='pull' state='running'>
       <disk dst='vdb'/>
-      <base node='libvirt-14-format'/>
+      <base node='libvirt-14-storage'/>
     </blockjob>
     <blockjob name='test-orphan-job0' type='copy' state='ready'>
       <chains>
-- 
2.41.0
Re: [PATCH 01/31] qemu: domain: Identify blockjobs by storage nodename in VM status XML
Posted by Ján Tomko 2 years, 3 months ago
On a Monday in 2023, Peter Krempa wrote:
>Use the node name of the storage access driver to identify the block job
>volumes. This will prepare the blockjob code to the possibility that the

s/to the/for the/

>format layer may be missing. Our lookup code can find either of them,
>thus we can safely switch.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/qemu/qemu_domain.c                               |  8 ++++----
> tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml | 12 ++++++------
> 2 files changed, 10 insertions(+), 10 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano