qemu: don't raise error upon interface update without <frames/> for <rx/> in coalesce

With this, incomplete XML without <frames/> for <rx/> in coalesce
won't raise error as before. It will leave the coalesce parameter
empty, thanks to passing it as a parameter and return an integer
to indicate error state - previously it returned pointer (or NULL
for both error and incomplete XML).
I also added a test case to test this functionality in the
qemuxml2xmltest.

The code went through some refactoring:
* change of a condition
* addition of a parameter
* change of order, that allowed removal of VIR_FREE
* removal of redundant labels and variables

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1535930
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Kristina Hanicova
2021-03-10 18:01:17 +01:00
committed by Martin Kletzander
parent e2602f2bb1
commit 511bdb0bb2
3 changed files with 26 additions and 16 deletions

View File

@@ -55,6 +55,15 @@
</rx>
</coalesce>
</interface>
<interface type='network'>
<source network='default'/>
<mac address='52:54:00:e5:48:60'/>
<model type='virtio'/>
<coalesce>
<rx>
</rx>
</coalesce>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>

View File

@@ -56,6 +56,12 @@
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</interface>
<interface type='network'>
<mac address='52:54:00:e5:48:60'/>
<source network='default'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</interface>
<serial type='pty'>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
@@ -68,7 +74,7 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</memballoon>
</devices>
</domain>