提交 cc7368e9 编写于 作者: J Ján Tomko

Use a separate buffer for <watchdog> subelements

Convert virDomainWatchdogDefFormat to use a separate
buffer for subelements.
上级 a0d43268
......@@ -23291,6 +23291,9 @@ virDomainWatchdogDefFormat(virBufferPtr buf,
{
const char *model = virDomainWatchdogModelTypeToString(def->model);
const char *action = virDomainWatchdogActionTypeToString(def->action);
virBuffer childBuf = VIR_BUFFER_INITIALIZER;
virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2);
if (!model) {
virReportError(VIR_ERR_INTERNAL_ERROR,
......@@ -23304,15 +23307,18 @@ virDomainWatchdogDefFormat(virBufferPtr buf,
return -1;
}
if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0)
return -1;
if (virBufferCheckError(&childBuf) < 0)
return -1;
virBufferAsprintf(buf, "<watchdog model='%s' action='%s'",
model, action);
if (virDomainDeviceInfoNeedsFormat(&def->info, flags)) {
if (virBufferUse(&childBuf)) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
return -1;
virBufferAdjustIndent(buf, -2);
virBufferAddBuffer(buf, &childBuf);
virBufferAddLit(buf, "</watchdog>\n");
} else {
virBufferAddLit(buf, "/>\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册