The <guest/> child element of <interface/> 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 <mprivozn(a)redhat.com>
---
src/conf/domain_conf.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
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, "<guest");
+ g_auto(virBuffer) guestAttrBuf = VIR_BUFFER_INITIALIZER;
+
/* Skip auto-generated target names for inactive config. */
- if (def->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, "<model type='%s'/>\n",
virDomainNetGetModelString(def));
--
2.39.1