[PATCH 68/80] qemu: domain: Assume QEMU_CAPS_BLOCKDEV for the domain private code

Peter Krempa pkrempa at redhat.com
Tue Jul 26 14:37:46 UTC 2022


Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_domain.c                        | 20 ++++++++-----------
 .../blockjob-mirror-in.xml                    |  1 +
 .../migration-in-params-in.xml                |  1 +
 .../migration-out-nbd-out.xml                 |  1 +
 .../migration-out-nbd-tls-out.xml             |  1 +
 .../migration-out-params-in.xml               |  1 +
 tests/qemustatusxml2xmldata/upgrade-out.xml   |  1 +
 .../qemustatusxml2xmldata/vcpus-multi-in.xml  |  1 +
 8 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 8b55dd0361..32319c1503 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2167,8 +2167,7 @@ qemuDomainObjPrivateXMLFormatBlockjobs(virBuffer *buf,
     virBufferAsprintf(&attrBuf, " active='%s'",
                       virTristateBoolTypeToString(virTristateBoolFromBool(bj)));

-    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) &&
-        virHashForEachSorted(priv->blockjobs,
+    if (virHashForEachSorted(priv->blockjobs,
                              qemuDomainObjPrivateXMLFormatBlockjobIterator,
                              &iterdata) < 0)
         return -1;
@@ -2388,8 +2387,7 @@ qemuDomainObjPrivateXMLFormat(virBuffer *buf,

     qemuDomainObjPrivateXMLFormatPR(buf, priv);

-    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))
-        virBufferAsprintf(buf, "<nodename index='%llu'/>\n", priv->nodenameindex);
+    virBufferAsprintf(buf, "<nodename index='%llu'/>\n", priv->nodenameindex);

     virBufferAsprintf(buf, "<fdset index='%u'/>\n", priv->fdsetindex);

@@ -2817,15 +2815,13 @@ qemuDomainObjPrivateXMLParseBlockjobs(virDomainObj *vm,
         (tmp = virTristateBoolTypeFromString(active)) > 0)
         priv->reconnectBlockjobs = tmp;

-    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
-        if ((nnodes = virXPathNodeSet("./blockjobs/blockjob", ctxt, &nodes)) < 0)
-            return -1;
+    if ((nnodes = virXPathNodeSet("./blockjobs/blockjob", ctxt, &nodes)) < 0)
+        return -1;

-        for (i = 0; i < nnodes; i++) {
-            if (qemuDomainObjPrivateXMLParseBlockjobData(vm, nodes[i], ctxt,
-                                                         priv->driver->xmlopt) < 0)
-                return -1;
-        }
+    for (i = 0; i < nnodes; i++) {
+        if (qemuDomainObjPrivateXMLParseBlockjobData(vm, nodes[i], ctxt,
+                                                     priv->driver->xmlopt) < 0)
+            return -1;
     }

     return 0;
diff --git a/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml b/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml
index 73fe437f87..e9f1d77856 100644
--- a/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml
+++ b/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml
@@ -22,6 +22,7 @@
   <libDir path='/tmp'/>
   <channelTargetDir path='/tmp/channel'/>
   <allowReboot value='yes'/>
+  <nodename index='0'/>
   <fdset index='0'/>
   <blockjobs active='yes'/>
   <agentTimeout>-2</agentTimeout>
diff --git a/tests/qemustatusxml2xmldata/migration-in-params-in.xml b/tests/qemustatusxml2xmldata/migration-in-params-in.xml
index 1086f5230d..03773a089b 100644
--- a/tests/qemustatusxml2xmldata/migration-in-params-in.xml
+++ b/tests/qemustatusxml2xmldata/migration-in-params-in.xml
@@ -256,6 +256,7 @@
   <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-1-nest'/>
   <chardevStdioLogd/>
   <allowReboot value='yes'/>
+  <nodename index='0'/>
   <fdset index='0'/>
   <blockjobs active='no'/>
   <agentTimeout>-2</agentTimeout>
diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml b/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml
index 540e385de3..de92146eaa 100644
--- a/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml
+++ b/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml
@@ -259,6 +259,7 @@
   <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-4-upstream'/>
   <chardevStdioLogd/>
   <allowReboot value='yes'/>
+  <nodename index='0'/>
   <fdset index='0'/>
   <blockjobs active='no'/>
   <agentTimeout>-2</agentTimeout>
diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml b/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml
index d0e997913f..6bdd128259 100644
--- a/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml
+++ b/tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.xml
@@ -288,6 +288,7 @@
   <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-3-upstream'/>
   <chardevStdioLogd/>
   <allowReboot value='yes'/>
+  <nodename index='0'/>
   <fdset index='0'/>
   <blockjobs active='no'/>
   <agentTimeout>-2</agentTimeout>
diff --git a/tests/qemustatusxml2xmldata/migration-out-params-in.xml b/tests/qemustatusxml2xmldata/migration-out-params-in.xml
index 758a6f03b7..24ee86e4c0 100644
--- a/tests/qemustatusxml2xmldata/migration-out-params-in.xml
+++ b/tests/qemustatusxml2xmldata/migration-out-params-in.xml
@@ -270,6 +270,7 @@
   <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-7-nest'/>
   <chardevStdioLogd/>
   <allowReboot value='yes'/>
+  <nodename index='0'/>
   <fdset index='0'/>
   <blockjobs active='no'/>
   <agentTimeout>-2</agentTimeout>
diff --git a/tests/qemustatusxml2xmldata/upgrade-out.xml b/tests/qemustatusxml2xmldata/upgrade-out.xml
index ac2ffeddc2..e663b3dbb5 100644
--- a/tests/qemustatusxml2xmldata/upgrade-out.xml
+++ b/tests/qemustatusxml2xmldata/upgrade-out.xml
@@ -258,6 +258,7 @@
   <channelTargetDir path='/var/lib/libvirt/qemu/channel/target/domain-1-upstream'/>
   <chardevStdioLogd/>
   <allowReboot value='yes'/>
+  <nodename index='0'/>
   <fdset index='0'/>
   <blockjobs active='no'/>
   <agentTimeout>-2</agentTimeout>
diff --git a/tests/qemustatusxml2xmldata/vcpus-multi-in.xml b/tests/qemustatusxml2xmldata/vcpus-multi-in.xml
index 0b8bc37c15..e71d6a83c7 100644
--- a/tests/qemustatusxml2xmldata/vcpus-multi-in.xml
+++ b/tests/qemustatusxml2xmldata/vcpus-multi-in.xml
@@ -308,6 +308,7 @@
   <libDir path='/tmp'/>
   <channelTargetDir path='/tmp/channel'/>
   <allowReboot value='yes'/>
+  <nodename index='0'/>
   <fdset index='0'/>
   <blockjobs active='no'/>
   <agentTimeout>-2</agentTimeout>
-- 
2.36.1



More information about the libvir-list mailing list