From nobody Sun Feb 8 20:00:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505413415408279.4808809801067; Thu, 14 Sep 2017 11:23:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A8904A6F1; Thu, 14 Sep 2017 18:23:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B5F3836F9; Thu, 14 Sep 2017 18:23:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7C4A91806107; Thu, 14 Sep 2017 18:23:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8EI3HLo018352 for ; Thu, 14 Sep 2017 14:03:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1D8E517103; Thu, 14 Sep 2017 18:03:17 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-172.phx2.redhat.com [10.3.116.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB7B56682E for ; Thu, 14 Sep 2017 18:03:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2A8904A6F1 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: John Ferlan To: libvir-list@redhat.com Date: Thu, 14 Sep 2017 14:03:10 -0400 Message-Id: <20170914180310.1426-7-jferlan@redhat.com> In-Reply-To: <20170914180310.1426-1-jferlan@redhat.com> References: <20170914180310.1426-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/6] conf: Use virXMLFormatElement to format disk source network X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 14 Sep 2017 18:23:34 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 --- 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, =20 =20 static int -virDomainDiskSourceFormatNetwork(virBufferPtr buf, +virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf, + virBufferPtr childBuf, virStorageSourcePtr src) { size_t n; char *path =3D NULL; =20 - virBufferAsprintf(buf, "protocol)); =20 if (src->volume) { @@ -21688,36 +21689,29 @@ virDomainDiskSourceFormatNetwork(virBufferPtr buf, return -1; } =20 - virBufferEscapeString(buf, " name=3D'%s'", path ? path : src->path); + virBufferEscapeString(attrBuf, " name=3D'%s'", path ? path : src->path= ); =20 VIR_FREE(path); =20 - if (src->nhosts =3D=3D 0 && !src->snapshot && !src->configFile) { - virBufferAddLit(buf, "/>\n"); - } else { - virBufferAddLit(buf, ">\n"); - virBufferAdjustIndent(buf, 2); + if (src->nhosts > 0 || src->snapshot || src->configFile) { =20 for (n =3D 0; n < src->nhosts; n++) { - virBufferAddLit(buf, "hosts[n].name); + virBufferAddLit(childBuf, "hosts[n].= name); =20 if (src->hosts[n].port) - virBufferAsprintf(buf, " port=3D'%u'", src->hosts[n].port); + virBufferAsprintf(childBuf, " port=3D'%u'", src->hosts[n].= port); =20 if (src->hosts[n].transport) - virBufferAsprintf(buf, " transport=3D'%s'", + virBufferAsprintf(childBuf, " transport=3D'%s'", virStorageNetHostTransportTypeToString(s= rc->hosts[n].transport)); =20 - virBufferEscapeString(buf, " socket=3D'%s'", src->hosts[n].soc= ket); - virBufferAddLit(buf, "/>\n"); + virBufferEscapeString(childBuf, " socket=3D'%s'", src->hosts[n= ].socket); + virBufferAddLit(childBuf, "/>\n"); } =20 - virBufferEscapeString(buf, "\n", src->snaps= hot); - virBufferEscapeString(buf, "\n", src->configF= ile); - - virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "\n"); + virBufferEscapeString(childBuf, "\n", src->= snapshot); + virBufferEscapeString(childBuf, "\n", src->co= nfigFile); } =20 return 0; @@ -21766,7 +21760,7 @@ virDomainDiskSourceFormatInternal(virBufferPtr buf, break; =20 case VIR_STORAGE_TYPE_NETWORK: - if (virDomainDiskSourceFormatNetwork(buf, src) < 0) + if (virDomainDiskSourceFormatNetwork(&attrBuf, &childBuf, src)= < 0) goto error; break; =20 --=20 2.13.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list