diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 70dfcc5e29546e5215d9c92a47a1ef3d7e25be8f..32ed5a09f9fe43d803c8afb51f1da020362b424f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2856,6 +2856,10 @@ virStorageSourceGetActualType; virStorageSourceGetSecurityLabelDef; virStorageSourceHasBacking; virStorageSourceInitChainElement; +virStorageSourceInitiatorClear; +virStorageSourceInitiatorCopy; +virStorageSourceInitiatorFormatXML; +virStorageSourceInitiatorParseXML; virStorageSourceIsBacking; virStorageSourceIsBlockLocal; virStorageSourceIsEmpty; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 56082f34e9156adbb4f5f4b60dce2fd9ab179d1f..fb79ceddd098b0ff51063295dab0391d5bdfdfbe 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -4314,6 +4314,40 @@ virStorageSourcePrivateDataFormatRelPath(virStorageSourcePtr src, return 0; } +void +virStorageSourceInitiatorParseXML(xmlXPathContextPtr ctxt, + virStorageSourceInitiatorDefPtr initiator) +{ + initiator->iqn = virXPathString("string(./initiator/iqn/@name)", ctxt); +} + +void +virStorageSourceInitiatorFormatXML(virStorageSourceInitiatorDefPtr initiator, + virBufferPtr buf) +{ + if (!initiator->iqn) + return; + + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); + virBufferEscapeString(buf, "\n", initiator->iqn); + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); +} + +int +virStorageSourceInitiatorCopy(virStorageSourceInitiatorDefPtr dest, + const virStorageSourceInitiatorDef *src) +{ + return VIR_STRDUP(dest->iqn, src->iqn); +} + +void +virStorageSourceInitiatorClear(virStorageSourceInitiatorDefPtr initiator) +{ + VIR_FREE(initiator->iqn); +} + static bool virStorageFileIsInitialized(const virStorageSource *src) { diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index d9e27a4a5fffb0d9a6f9f2856bccd4111dd20a8f..b6013431cc3fadc7e899aa875baa790c18853fc9 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -492,6 +492,21 @@ int virStorageSourcePrivateDataFormatRelPath(virStorageSourcePtr src, virBufferPtr buf); +void +virStorageSourceInitiatorParseXML(xmlXPathContextPtr ctxt, + virStorageSourceInitiatorDefPtr initiator); + +void +virStorageSourceInitiatorFormatXML(virStorageSourceInitiatorDefPtr initiator, + virBufferPtr buf); + +int +virStorageSourceInitiatorCopy(virStorageSourceInitiatorDefPtr dest, + const virStorageSourceInitiatorDef *src); + +void +virStorageSourceInitiatorClear(virStorageSourceInitiatorDefPtr initiator); + int virStorageFileInit(virStorageSourcePtr src); int virStorageFileInitAs(virStorageSourcePtr src, uid_t uid, gid_t gid);