[libvirt] [PATCH] Only probe for CPU models if required

Daniel Veillard veillard at redhat.com
Tue Dec 22 11:28:06 UTC 2009


On Mon, Dec 21, 2009 at 07:12:31PM +0000, Daniel P. Berrange wrote:
> On Mon, Dec 21, 2009 at 05:44:50PM +0100, Jiri Denemark wrote:
> > CPU models where probe everytime a qemu command line was built. But it
> > only makes sense to do so when a guest's XML contains CPU model.
> > 
> > Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> > ---
> >  src/qemu/qemu_conf.c |    7 ++++---
> >  1 files changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> > index 36bf9a2..3f6c79b 100644
> > --- a/src/qemu/qemu_conf.c
> > +++ b/src/qemu/qemu_conf.c
> > @@ -1778,17 +1778,18 @@ qemudBuildCommandLineCPU(virConnectPtr conn,
> >  {
> >      const virCPUDefPtr host = driver->caps->host.cpu;
> >      virCPUDefPtr guest = NULL;
> > -    unsigned int ncpus;
> > +    unsigned int ncpus = 0;
> >      const char **cpus = NULL;
> >      union cpuData *data = NULL;
> >      int ret = -1;
> >      virBuffer buf = VIR_BUFFER_INITIALIZER;
> >      int i;
> >  
> > -    if (qemudProbeCPUModels(emulator, ut->machine, &ncpus, &cpus) < 0)
> > +    if (def->cpu && def->cpu->model
> > +        && qemudProbeCPUModels(emulator, ut->machine, &ncpus, &cpus) < 0)
> >          goto cleanup;
> >  
> > -    if (ncpus > 0 && host && def->cpu && def->cpu->model) {
> > +    if (ncpus > 0 && host) {
> >          virCPUCompareResult cmp;
> >  
> >          cmp = cpuGuestData(conn, host, def->cpu, &data);
> 
> ACK, this should fix the test suite failures seen where it tries to
> run a QEMU binary when generating ARGV. Eventually we should move
> the probe call init the code which generates the capabilities data
> and keep the list of CPUs permanently.

  And maybe keep a timestamp on the read cpu_map file to be able to
reload if needed. But that's good enough for now !

 ACK, pushed !

   thanks,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list