mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
qemu: Split out virQEMUCapsFormatCache
All the code for formatting machine type data was moved to a standalone virQEMUCapsFormatMachines function. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
299f12ad1f
commit
4682197641
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user