[libvirt] [PATCH] cpuBaseline: Don't mess with the CPU returned by arch driver

All features in the baseline CPU definition were always created with policy='require' even though an arch driver returned them with different policy settings. --- src/cpu/cpu.c | 12 +----------- src/cpu/cpu_x86.c | 2 ++ 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 580b767..8d6c22b 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -354,7 +354,6 @@ cpuBaseline(virCPUDefPtr *cpus, unsigned int nmodels) { struct cpuArchDriver *driver; - virCPUDefPtr cpu; unsigned int i; VIR_DEBUG("ncpus=%u, nmodels=%u", ncpus, nmodels); @@ -394,16 +393,7 @@ cpuBaseline(virCPUDefPtr *cpus, return NULL; } - if ((cpu = driver->baseline(cpus, ncpus, models, nmodels))) { - cpu->type = VIR_CPU_TYPE_GUEST; - cpu->match = VIR_CPU_MATCH_EXACT; - VIR_FREE(cpu->arch); - - for (i = 0; i < cpu->nfeatures; i++) - cpu->features[i].policy = VIR_CPU_FEATURE_REQUIRE; - } - - return cpu; + return driver->baseline(cpus, ncpus, models, nmodels); } diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index f7473bf..30a2db6 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1366,6 +1366,8 @@ x86Baseline(virCPUDefPtr *cpus, if (x86Decode(cpu, data, models, nmodels, NULL) < 0) goto error; + VIR_FREE(cpu->arch); + cleanup: x86DataFree(data); x86ModelFree(base_model); -- 1.7.1.1

On Fri, Jul 02, 2010 at 11:16:09PM +0200, Jiri Denemark wrote:
All features in the baseline CPU definition were always created with policy='require' even though an arch driver returned them with different policy settings. --- src/cpu/cpu.c | 12 +----------- src/cpu/cpu_x86.c | 2 ++ 2 files changed, 3 insertions(+), 11 deletions(-)
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

All features in the baseline CPU definition were always created with policy='require' even though an arch driver returned them with different policy settings. --- src/cpu/cpu.c | 12 +----------- src/cpu/cpu_x86.c | 2 ++ 2 files changed, 3 insertions(+), 11 deletions(-)
ACK
Thanks, pushed. Jirka
participants (2)
-
Daniel P. Berrange
-
Jiri Denemark