提交 218c81ea 编写于 作者: P Peter Krempa

conf: Merge virDomainStorageSourceFormat into virDomainDiskSourceFormat

There was only one caller, remove the unnecessary wrapper.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 0f13b78b
......@@ -23716,38 +23716,45 @@ virDomainDiskSourceFormatPrivateData(virBufferPtr buf,
}
static int
virDomainStorageSourceFormat(virBufferPtr attrBuf,
virBufferPtr childBuf,
virStorageSourcePtr src,
unsigned int flags)
int
virDomainDiskSourceFormat(virBufferPtr buf,
virStorageSourcePtr src,
int policy,
bool attrIndex,
unsigned int flags,
virDomainXMLOptionPtr xmlopt)
{
VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
virBufferSetChildIndent(&childBuf, buf);
switch ((virStorageType)src->type) {
case VIR_STORAGE_TYPE_FILE:
virBufferEscapeString(attrBuf, " file='%s'", src->path);
virBufferEscapeString(&attrBuf, " file='%s'", src->path);
break;
case VIR_STORAGE_TYPE_BLOCK:
virBufferEscapeString(attrBuf, " dev='%s'", src->path);
virBufferEscapeString(&attrBuf, " dev='%s'", src->path);
break;
case VIR_STORAGE_TYPE_DIR:
virBufferEscapeString(attrBuf, " dir='%s'", src->path);
virBufferEscapeString(&attrBuf, " dir='%s'", src->path);
break;
case VIR_STORAGE_TYPE_NETWORK:
if (virDomainDiskSourceFormatNetwork(attrBuf, childBuf,
if (virDomainDiskSourceFormatNetwork(&attrBuf, &childBuf,
src, flags) < 0)
return -1;
break;
case VIR_STORAGE_TYPE_VOLUME:
if (src->srcpool) {
virBufferEscapeString(attrBuf, " pool='%s'", src->srcpool->pool);
virBufferEscapeString(attrBuf, " volume='%s'",
virBufferEscapeString(&attrBuf, " pool='%s'", src->srcpool->pool);
virBufferEscapeString(&attrBuf, " volume='%s'",
src->srcpool->volume);
if (src->srcpool->mode)
virBufferAsprintf(attrBuf, " mode='%s'",
virBufferAsprintf(&attrBuf, " mode='%s'",
virStorageSourcePoolModeTypeToString(src->srcpool->mode));
}
......@@ -23761,7 +23768,7 @@ virDomainStorageSourceFormat(virBufferPtr attrBuf,
}
if (src->type != VIR_STORAGE_TYPE_NETWORK)
virDomainSourceDefFormatSeclabel(childBuf, src->nseclabels,
virDomainSourceDefFormatSeclabel(&childBuf, src->nseclabels,
src->seclabels, flags);
/* Storage Source formatting will not carry through the blunder
......@@ -23771,38 +23778,17 @@ virDomainStorageSourceFormat(virBufferPtr attrBuf,
* So avoid formatting it for volumes. */
if (src->auth && src->authInherited &&
src->type != VIR_STORAGE_TYPE_VOLUME)
virStorageAuthDefFormat(childBuf, src->auth);
virStorageAuthDefFormat(&childBuf, src->auth);
/* If we found encryption as a child of <source>, then format it
* as we found it. */
if (src->encryption && src->encryptionInherited &&
virStorageEncryptionFormat(childBuf, src->encryption) < 0)
virStorageEncryptionFormat(&childBuf, src->encryption) < 0)
return -1;
if (src->pr)
virStoragePRDefFormat(childBuf, src->pr,
virStoragePRDefFormat(&childBuf, src->pr,
flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE);
return 0;
}
int
virDomainDiskSourceFormat(virBufferPtr buf,
virStorageSourcePtr src,
int policy,
bool attrIndex,
unsigned int flags,
virDomainXMLOptionPtr xmlopt)
{
VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
virBufferSetChildIndent(&childBuf, buf);
if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, flags) < 0)
return -1;
if (policy && src->type != VIR_STORAGE_TYPE_NETWORK)
virBufferEscapeString(&attrBuf, " startupPolicy='%s'",
virDomainStartupPolicyTypeToString(policy));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册