[PATCH 09/15] qemuDomainObjPrivateAlloc: Use virHashNew instead of virHashCreate

Peter Krempa pkrempa at redhat.com
Thu Oct 22 09:35:00 UTC 2020


virHashCreate will be removed in upcoming patches. This change has an
impact on ordering of the blockjob entries in one of the status XML->XML
tests.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_domain.c                        |   2 +-
 .../blockjob-blockdev-in.xml                  | 110 +++++++++---------
 2 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index eeceb44348..bea43a1aba 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1697,7 +1697,7 @@ qemuDomainObjPrivateAlloc(void *opaque)
     if (!(priv->devs = virChrdevAlloc()))
         goto error;

-    if (!(priv->blockjobs = virHashCreate(5, virObjectFreeHashData)))
+    if (!(priv->blockjobs = virHashNew(virObjectFreeHashData)))
         goto error;

     /* agent commands block by default, user can choose different behavior */
diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
index ca6d110179..8ffc91bdcb 100644
--- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
+++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
@@ -244,64 +244,9 @@
       <top node='libvirt-17-format'/>
       <deleteCommittedImages/>
     </blockjob>
-    <blockjob name='create-libvirt-1337-storage' type='create' state='running'>
-      <create mode='storage'/>
-      <src type='network' format='qcow2'>
-        <source protocol='rbd' name='pool/volname.qcow2' tlsFromConfig='0' index='1337'>
-          <host name='example.org'/>
-          <privateData>
-            <nodenames>
-              <nodename type='storage' name='libvirt-1337-storage'/>
-              <nodename type='format' name='libvirt-1337-format'/>
-            </nodenames>
-            <objects>
-              <secret type='auth' alias='libvirt-1337-storage-secret0'/>
-            </objects>
-          </privateData>
-        </source>
-      </src>
-    </blockjob>
-    <blockjob name='copy-vdd-libvirt-4321-format' type='copy' state='ready' jobflags='0x0' shallownew='yes'>
-      <disk dst='vdd'/>
-    </blockjob>
-    <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'/>
-    </blockjob>
     <blockjob name='drive-virtio-disk0' type='copy' state='ready' jobflags='0x0'>
       <disk dst='vda' mirror='yes'/>
     </blockjob>
-    <blockjob name='create-libvirt-1338-format' type='create' state='running' jobflags='0xabcd'>
-      <chains>
-        <disk type='file' format='qcow2'>
-          <source file='/create/src1.qcow2' index='1339'>
-            <privateData>
-              <nodenames>
-                <nodename type='storage' name='libvirt-1339-storage'/>
-                <nodename type='format' name='libvirt-1339-format'/>
-              </nodenames>
-            </privateData>
-          </source>
-          <backingStore/>
-        </disk>
-      </chains>
-      <src type='file' format='qcow2'>
-        <source file='/tmp/create/overlay.qcow2' index='1338'>
-          <privateData>
-            <nodenames>
-              <nodename type='storage' name='libvirt-1338-storage'/>
-              <nodename type='format' name='libvirt-1338-format'/>
-            </nodenames>
-            <objects>
-              <secret type='encryption' alias='libvirt-1338-storage-secret0'/>
-            </objects>
-          </privateData>
-        </source>
-      </src>
-    </blockjob>
-    <blockjob name='broken-test' type='broken' state='ready' brokentype='commit'/>
     <blockjob name='test-orphan-job0' type='copy' state='ready'>
       <chains>
         <disk type='file' format='qcow2'>
@@ -339,6 +284,61 @@
         </mirror>
       </chains>
     </blockjob>
+    <blockjob name='broken-test' type='broken' state='ready' brokentype='commit'/>
+    <blockjob name='create-libvirt-1338-format' type='create' state='running' jobflags='0xabcd'>
+      <chains>
+        <disk type='file' format='qcow2'>
+          <source file='/create/src1.qcow2' index='1339'>
+            <privateData>
+              <nodenames>
+                <nodename type='storage' name='libvirt-1339-storage'/>
+                <nodename type='format' name='libvirt-1339-format'/>
+              </nodenames>
+            </privateData>
+          </source>
+          <backingStore/>
+        </disk>
+      </chains>
+      <src type='file' format='qcow2'>
+        <source file='/tmp/create/overlay.qcow2' index='1338'>
+          <privateData>
+            <nodenames>
+              <nodename type='storage' name='libvirt-1338-storage'/>
+              <nodename type='format' name='libvirt-1338-format'/>
+            </nodenames>
+            <objects>
+              <secret type='encryption' alias='libvirt-1338-storage-secret0'/>
+            </objects>
+          </privateData>
+        </source>
+      </src>
+    </blockjob>
+    <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'/>
+    </blockjob>
+    <blockjob name='create-libvirt-1337-storage' type='create' state='running'>
+      <create mode='storage'/>
+      <src type='network' format='qcow2'>
+        <source protocol='rbd' name='pool/volname.qcow2' tlsFromConfig='0' index='1337'>
+          <host name='example.org'/>
+          <privateData>
+            <nodenames>
+              <nodename type='storage' name='libvirt-1337-storage'/>
+              <nodename type='format' name='libvirt-1337-format'/>
+            </nodenames>
+            <objects>
+              <secret type='auth' alias='libvirt-1337-storage-secret0'/>
+            </objects>
+          </privateData>
+        </source>
+      </src>
+    </blockjob>
+    <blockjob name='copy-vdd-libvirt-4321-format' type='copy' state='ready' jobflags='0x0' shallownew='yes'>
+      <disk dst='vdd'/>
+    </blockjob>
   </blockjobs>
   <agentTimeout>-2</agentTimeout>
   <domain type='kvm' id='4'>
-- 
2.26.2




More information about the libvir-list mailing list