From: Michal Privoznik Date: Tue, 31 Jan 2023 12:42:13 +0000 (+0100) Subject: virDomainNetDefFormat: Modernize formatting X-Git-Tag: v9.1.0-rc1~139 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a7c6e0c4c4a70348700f8fba08034258cca967b;p=thirdparty%2Flibvirt.git virDomainNetDefFormat: Modernize formatting The child element of is formatted the old way. Switch to virXMLFormatElement(). Since this element is used in LXC driver, this part of the function is tested by lxcxml2xmltest (specifically lxc-ethernet* test cases). Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4c6f79efe3..bab8f09e26 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23955,16 +23955,17 @@ virDomainNetDefFormat(virBuffer *buf, virXMLFormatElement(buf, "target", &targetAttrBuf, NULL); if (def->ifname_guest || def->ifname_guest_actual) { - virBufferAddLit(buf, "ifname_guest) - virBufferEscapeString(buf, " dev='%s'", def->ifname_guest); + virBufferEscapeString(&guestAttrBuf, " dev='%s'", def->ifname_guest); /* Only set if the host is running, so shouldn't pollute output */ - if (def->ifname_guest_actual) - virBufferEscapeString(buf, " actual='%s'", def->ifname_guest_actual); - virBufferAddLit(buf, "/>\n"); + virBufferEscapeString(&guestAttrBuf, " actual='%s'", def->ifname_guest_actual); + + virXMLFormatElement(buf, "guest", &guestAttrBuf, NULL); } + if (virDomainNetGetModelString(def)) { virBufferEscapeString(buf, "\n", virDomainNetGetModelString(def));