提交 5c0324ab 编写于 作者: P Pavel Hrdina

util: introduce virStorageSourceInitiator functions

The same code would be used for storage pools and domain disks.
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 1576c126
......@@ -2856,6 +2856,10 @@ virStorageSourceGetActualType;
virStorageSourceGetSecurityLabelDef;
virStorageSourceHasBacking;
virStorageSourceInitChainElement;
virStorageSourceInitiatorClear;
virStorageSourceInitiatorCopy;
virStorageSourceInitiatorFormatXML;
virStorageSourceInitiatorParseXML;
virStorageSourceIsBacking;
virStorageSourceIsBlockLocal;
virStorageSourceIsEmpty;
......
......@@ -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, "<initiator>\n");
virBufferAdjustIndent(buf, 2);
virBufferEscapeString(buf, "<iqn name='%s'/>\n", initiator->iqn);
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</initiator>\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)
{
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册