]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virDomainNetDefFormat: Modernize <tune/> formatting
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 31 Jan 2023 09:46:59 +0000 (10:46 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 1 Feb 2023 07:36:24 +0000 (08:36 +0100)
The <tune/> child element of <interface/> is formatted the old
way. Switch to virXMLFormatElement().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/conf/domain_conf.c
tests/qemuxml2argvdata/net-mtu.xml

index 382c32db67343c37f9131b28ad96884b9efdea83..4c6f79efe3564fefb76e6dd3acf270af4fc818dc 100644 (file)
@@ -23993,11 +23993,11 @@ virDomainNetDefFormat(virBuffer *buf,
     }
 
     if (def->tune.sndbuf_specified) {
-        virBufferAddLit(buf,   "<tune>\n");
-        virBufferAdjustIndent(buf, 2);
-        virBufferAsprintf(buf, "<sndbuf>%llu</sndbuf>\n", def->tune.sndbuf);
-        virBufferAdjustIndent(buf, -2);
-        virBufferAddLit(buf,   "</tune>\n");
+        g_auto(virBuffer) sndChildBuf = VIR_BUFFER_INIT_CHILD(buf);
+
+        virBufferAsprintf(&sndChildBuf, "<sndbuf>%llu</sndbuf>\n", def->tune.sndbuf);
+
+        virXMLFormatElement(buf, "tune", NULL, &sndChildBuf);
     }
 
     virDomainNetTeamingInfoFormat(def->teaming, buf);
index 900548b4652c3aa62fbaa0d03002eb08d2b16d8d..092978bea0401c78f55a62a0ebac389d77f3bf97 100644 (file)
@@ -50,6 +50,9 @@
       <mac address='52:54:00:e5:48:59'/>
       <source network='default'/>
       <model type='virtio'/>
+      <tune>
+        <sndbuf>1600</sndbuf>
+      </tune>
       <mtu size='9000'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </interface>