From af6ac80e435e3232f8a36008e0825b505520b7f5 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Tue, 7 Aug 2018 13:31:31 +0200 Subject: [PATCH] conf: use virStorageSourceInitiator functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Ján Tomko Signed-off-by: Pavel Hrdina --- src/conf/storage_conf.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index a0c92af820..50dbc937e7 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -380,7 +380,7 @@ virStoragePoolSourceClear(virStoragePoolSourcePtr source) VIR_FREE(source->dir); VIR_FREE(source->name); virStorageAdapterClear(&source->adapter); - VIR_FREE(source->initiator.iqn); + virStorageSourceInitiatorClear(&source->initiator); virStorageAuthDefFree(source->auth); VIR_FREE(source->vendor); VIR_FREE(source->product); @@ -488,7 +488,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, } VIR_FREE(nodeset); - source->initiator.iqn = virXPathString("string(./initiator/iqn/@name)", ctxt); + + virStorageSourceInitiatorParseXML(ctxt, &source->initiator); nsource = virXPathNodeSet("./device", ctxt, &nodeset); if (nsource < 0) @@ -950,15 +951,8 @@ virStoragePoolSourceFormat(virBufferPtr buf, if (options->flags & VIR_STORAGE_POOL_SOURCE_NAME) virBufferEscapeString(buf, "%s\n", src->name); - if ((options->flags & VIR_STORAGE_POOL_SOURCE_INITIATOR_IQN) && - src->initiator.iqn) { - virBufferAddLit(buf, "\n"); - virBufferAdjustIndent(buf, 2); - virBufferEscapeString(buf, "\n", - src->initiator.iqn); - virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "\n"); - } + if (options->flags & VIR_STORAGE_POOL_SOURCE_INITIATOR_IQN) + virStorageSourceInitiatorFormatXML(&src->initiator, buf); if (options->formatToString) { const char *format = (options->formatToString)(src->format);