[libvirt] Couple qemu driver bugs after xml refactoring

Daniel P. Berrange berrange at redhat.com
Thu Jul 24 08:39:36 UTC 2008


On Tue, Jul 22, 2008 at 05:23:00PM +0100, Daniel P. Berrange wrote:
> On Tue, Jul 22, 2008 at 04:53:19PM +0100, Daniel P. Berrange wrote:
> > On Tue, Jul 22, 2008 at 11:42:03AM -0400, Cole Robinson wrote:
> > > Hi all,
> > > 
> > > I've hit a couple bugs in the qemu driver with the recent
> > > domain xml refactoring. I've debugged them but in both
> > > cases I'm not sure what the optimal solutions are, so I'm
> > > just laying them out here:
> > > 
> > > 1) Previously defining a qemu guest without a 'listen'
> > > address specified in the graphics tag would default to
> > > 127.0.0.1 (hardcoded in qemu_driver->vncListen). Current
> > > xml doesn't set this default, and will build a qemu
> > > command line with an entry like '-vnc (null):1'. Not
> > > sure if the default should be set at the parsing level
> > > or the driver level.
> > 
> > There was a good reason for removing the 127.0.0.1 from the XML parsing
> > stage, but i can't remember what it is :-) Anyway this should really be
> > handled at the point where we build the command line in the qemu driver
> > code
> 
> Oh I remember now - both Xen and QEMU have a global default setting
> for VNC listen (/etc/libvirt/qemu.conf and /etc/xen/xend-config.sxp).
> So, if we default to '127.0.0.1' in the parser, we'll always override
> the global hypervisor default setting. Hence we need to apply any
> defaults in the individual drivers at time of guest creation (if it
> is applicable).

Here's a suggested patch for this:

diff -r 59140de4e7a9 src/qemu_driver.c
--- a/src/qemu_driver.c	Mon Jul 21 18:27:29 2008 +0100
+++ b/src/qemu_driver.c	Tue Jul 22 22:12:22 2008 +0100
@@ -769,9 +769,14 @@
         maxcpu = nodeinfo.cpus;
 
     CPU_ZERO(&mask);
-    for (i = 0 ; i < maxcpu ; i++)
-        if (vm->def->cpumask[i])
+    if (vm->def->cpumask) {
+        for (i = 0 ; i < maxcpu ; i++)
+            if (vm->def->cpumask[i])
+                CPU_SET(i, &mask);
+    } else {
+        for (i = 0 ; i < maxcpu ; i++)
             CPU_SET(i, &mask);
+    }
 
     for (i = 0 ; i < vm->nvcpupids ; i++) {
         if (sched_setaffinity(vm->vcpupids[i],


NB, I explicitly set the affinity if none is specified - this makes sure
the children don't inherit any bogus affinity from the libvirtd daemon
itself

Daniel.
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list