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

qemu: Split out virQEMUCapsFormatCache

All the code for formatting machine type data was moved to a standalone
virQEMUCapsFormatMachines function.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 299f12ad
......@@ -4025,6 +4025,28 @@ virQEMUCapsFormatCPUModels(virQEMUCapsAccelPtr caps,
}
static void
virQEMUCapsFormatMachines(virQEMUCapsPtr qemuCaps,
virBufferPtr buf)
{
size_t i;
for (i = 0; i < qemuCaps->nmachineTypes; i++) {
virBufferEscapeString(buf, "<machine name='%s'",
qemuCaps->machineTypes[i].name);
virBufferEscapeString(buf, " alias='%s'",
qemuCaps->machineTypes[i].alias);
if (qemuCaps->machineTypes[i].hotplugCpus)
virBufferAddLit(buf, " hotplugCpus='yes'");
virBufferAsprintf(buf, " maxCpus='%u'",
qemuCaps->machineTypes[i].maxCpus);
if (qemuCaps->machineTypes[i].qemuDefault)
virBufferAddLit(buf, " default='yes'");
virBufferAddLit(buf, "/>\n");
}
}
static void
virQEMUCapsFormatAccel(virQEMUCapsPtr qemuCaps,
virBufferPtr buf,
......@@ -4103,20 +4125,7 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps)
virQEMUCapsFormatAccel(qemuCaps, &buf, VIR_DOMAIN_VIRT_KVM);
virQEMUCapsFormatAccel(qemuCaps, &buf, VIR_DOMAIN_VIRT_QEMU);
for (i = 0; i < qemuCaps->nmachineTypes; i++) {
virBufferEscapeString(&buf, "<machine name='%s'",
qemuCaps->machineTypes[i].name);
if (qemuCaps->machineTypes[i].alias)
virBufferEscapeString(&buf, " alias='%s'",
qemuCaps->machineTypes[i].alias);
if (qemuCaps->machineTypes[i].hotplugCpus)
virBufferAddLit(&buf, " hotplugCpus='yes'");
virBufferAsprintf(&buf, " maxCpus='%u'",
qemuCaps->machineTypes[i].maxCpus);
if (qemuCaps->machineTypes[i].qemuDefault)
virBufferAddLit(&buf, " default='yes'");
virBufferAddLit(&buf, "/>\n");
}
virQEMUCapsFormatMachines(qemuCaps, &buf);
for (i = 0; i < qemuCaps->ngicCapabilities; i++) {
virGICCapabilityPtr cap;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册