mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
virDomainNetDefFormat: Modernize <guest/> formatting
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@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
86d10e6259
commit
3a7c6e0c4c
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user