Commit id 'e02ff020cac' neglected to use the attrBuf and childBuf in the virDomainDiskSourceFormatNetwork call. So make the necessary alterations to allow usage. Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/conf/domain_conf.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 09c5bc1ae..a8771a3a4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21674,13 +21674,14 @@ virDomainSourceDefFormatSeclabel(virBufferPtr buf, static int -virDomainDiskSourceFormatNetwork(virBufferPtr buf, +virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf, + virBufferPtr childBuf, virStorageSourcePtr src) { size_t n; char *path = NULL; - virBufferAsprintf(buf, "<source protocol='%s'", + virBufferAsprintf(attrBuf, " protocol='%s'", virStorageNetProtocolTypeToString(src->protocol)); if (src->volume) { @@ -21688,36 +21689,29 @@ virDomainDiskSourceFormatNetwork(virBufferPtr buf, return -1; } - virBufferEscapeString(buf, " name='%s'", path ? path : src->path); + virBufferEscapeString(attrBuf, " name='%s'", path ? path : src->path); VIR_FREE(path); - if (src->nhosts == 0 && !src->snapshot && !src->configFile) { - virBufferAddLit(buf, "/>\n"); - } else { - virBufferAddLit(buf, ">\n"); - virBufferAdjustIndent(buf, 2); + if (src->nhosts > 0 || src->snapshot || src->configFile) { for (n = 0; n < src->nhosts; n++) { - virBufferAddLit(buf, "<host"); - virBufferEscapeString(buf, " name='%s'", src->hosts[n].name); + virBufferAddLit(childBuf, "<host"); + virBufferEscapeString(childBuf, " name='%s'", src->hosts[n].name); if (src->hosts[n].port) - virBufferAsprintf(buf, " port='%u'", src->hosts[n].port); + virBufferAsprintf(childBuf, " port='%u'", src->hosts[n].port); if (src->hosts[n].transport) - virBufferAsprintf(buf, " transport='%s'", + virBufferAsprintf(childBuf, " transport='%s'", virStorageNetHostTransportTypeToString(src->hosts[n].transport)); - virBufferEscapeString(buf, " socket='%s'", src->hosts[n].socket); - virBufferAddLit(buf, "/>\n"); + virBufferEscapeString(childBuf, " socket='%s'", src->hosts[n].socket); + virBufferAddLit(childBuf, "/>\n"); } - virBufferEscapeString(buf, "<snapshot name='%s'/>\n", src->snapshot); - virBufferEscapeString(buf, "<config file='%s'/>\n", src->configFile); - - virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "</source>\n"); + virBufferEscapeString(childBuf, "<snapshot name='%s'/>\n", src->snapshot); + virBufferEscapeString(childBuf, "<config file='%s'/>\n", src->configFile); } return 0; @@ -21766,7 +21760,7 @@ virDomainDiskSourceFormatInternal(virBufferPtr buf, break; case VIR_STORAGE_TYPE_NETWORK: - if (virDomainDiskSourceFormatNetwork(buf, src) < 0) + if (virDomainDiskSourceFormatNetwork(&attrBuf, &childBuf, src) < 0) goto error; break; -- 2.13.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list