提交 e2f7138a 编写于 作者: J Jiri Denemark

qemu: Introduce virQEMUCapsFormatHostCPUModelInfo

The CPU model info formating code in virQEMUCapsFormatCache will get
more complicated soon. Separating the code in
virQEMUCapsFormatHostCPUModelInfo will make the result easier to read.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 5c6fc9d6
......@@ -3539,6 +3539,27 @@ virQEMUCapsLoadCache(virCapsPtr caps,
}
static void
virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
virBufferPtr buf)
{
qemuMonitorCPUModelInfoPtr model = qemuCaps->hostCPUModelInfo;
size_t i;
virBufferAsprintf(buf, "<hostCPU model='%s'>\n", model->name);
virBufferAdjustIndent(buf, 2);
for (i = 0; i < model->nprops; i++) {
virBufferAsprintf(buf, "<feature name='%s' supported='%s'/>\n",
model->props[i].name,
model->props[i].supported ? "yes" : "no");
}
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</hostCPU>\n");
}
static void
virQEMUCapsFormatCPUModels(virQEMUCapsPtr qemuCaps,
virBufferPtr buf,
......@@ -3615,19 +3636,8 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps,
virBufferAsprintf(&buf, "<arch>%s</arch>\n",
virArchToString(qemuCaps->arch));
if (qemuCaps->hostCPUModelInfo) {
virBufferAsprintf(&buf, "<hostCPU model='%s'>\n",
qemuCaps->hostCPUModelInfo->name);
virBufferAdjustIndent(&buf, 2);
for (i = 0; i < qemuCaps->hostCPUModelInfo->nprops; i++) {
virBufferAsprintf(&buf, "<feature name='%s' supported='%s'/>\n",
qemuCaps->hostCPUModelInfo->props[i].name,
qemuCaps->hostCPUModelInfo->props[i].supported ?
"yes" : "no");
}
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</hostCPU>\n");
}
if (qemuCaps->hostCPUModelInfo)
virQEMUCapsFormatHostCPUModelInfo(qemuCaps, &buf);
virQEMUCapsFormatCPUModels(qemuCaps, &buf, VIR_DOMAIN_VIRT_KVM);
virQEMUCapsFormatCPUModels(qemuCaps, &buf, VIR_DOMAIN_VIRT_QEMU);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册