qemu: Introduce virQEMUCapsFormatCPUModels

This patch moves the CPU models formatting code from
virQEMUCapsFormatCache into a separate function.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2016-11-14 21:51:31 +01:00
parent 1bdcd7a4ee
commit 7c95619cb1

View File

@ -3294,6 +3294,21 @@ virQEMUCapsLoadCache(virCapsPtr caps,
}
static void
virQEMUCapsFormatCPUModels(virQEMUCapsPtr qemuCaps,
virBufferPtr buf)
{
size_t i;
if (qemuCaps->cpuDefinitions) {
for (i = 0; i < qemuCaps->cpuDefinitions->nmodels; i++) {
virDomainCapsCPUModelPtr cpu = qemuCaps->cpuDefinitions->models + i;
virBufferEscapeString(buf, "<cpu name='%s'/>\n", cpu->name);
}
}
}
char *
virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps,
time_t selfCTime,
@ -3336,12 +3351,7 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps,
virBufferAsprintf(&buf, "<arch>%s</arch>\n",
virArchToString(qemuCaps->arch));
if (qemuCaps->cpuDefinitions) {
for (i = 0; i < qemuCaps->cpuDefinitions->nmodels; i++) {
virDomainCapsCPUModelPtr cpu = qemuCaps->cpuDefinitions->models + i;
virBufferEscapeString(&buf, "<cpu name='%s'/>\n", cpu->name);
}
}
virQEMUCapsFormatCPUModels(qemuCaps, &buf);
for (i = 0; i < qemuCaps->nmachineTypes; i++) {
virBufferEscapeString(&buf, "<machine name='%s'",