[libvirt] [libvirt-sandbox][PATCH] module lookup and rundir fix

Daniel P. Berrange berrange at redhat.com
Tue Jun 12 12:18:28 UTC 2012


On Wed, May 30, 2012 at 10:24:59AM -0700, Radu C. wrote:
> Hello,
> I've been trying to get libvirt-sandbox working on my Gentoo box but I ran into some difficulties. The version I'm using is the latest git one.
> 
> 
> The first problem was the following when running virt-sandbox:
> "Unable to start sandbox: Error opening file '/tmp/libvirt-sandbox-9ivpRN/9pnet.ko': File exists"
> I pinpointed the problem to the following diff in commit [05fb94d2c42abe9cfd86c3663d704c268f325503]:
> -    gchar *moddirpath = g_strdup_printf("/lib/modules/%s/kernel",
> 
> +    gchar *moddirpath = g_strdup_printf("/lib/modules/%s",
> 
> The problem is that symlinks are made to the build directory and it finds a module multiple times.
> I inserted a printf in the lookup loop so here's what I mean:
> 
> dmns libvirt-sandbox # virt-sandbox -c qemu:///system -n test1323 -v
> -d /usr/bin/yes
> found: /lib/modules/3.4.0-gentoo/kernel/fs/fscache/fscache.ko
> found: /lib/modules/3.4.0-gentoo/source/fs/fscache/fscache.ko
> found: /lib/modules/3.4.0-gentoo/build/fs/fscache/fscache.ko
> found: /lib/modules/3.4.0-gentoo/kernel/net/9p/9pnet.ko
> found: /lib/modules/3.4.0-gentoo/source/net/9p/9pnet.ko
> found: /lib/modules/3.4.0-gentoo/build/net/9p/9pnet.ko
> found: /lib/modules/3.4.0-gentoo/kernel/fs/9p/9p.ko
> found: /lib/modules/3.4.0-gentoo/source/fs/9p/9p.ko
> found: /lib/modules/3.4.0-gentoo/build/fs/9p/9p.ko
> found: /lib/modules/3.4.0-gentoo/kernel/net/9p/9pnet_virtio.ko
> found: /lib/modules/3.4.0-gentoo/source/net/9p/9pnet_virtio.ko
> found: /lib/modules/3.4.0-gentoo/build/net/9p/9pnet_virtio.ko
> 
> The next problem was the following:
> 
> dmns libvirt-sandbox # virt-sandbox -c qemu:///system -n test123 -v -d
> /usr/bin/yes
> Unable to start sandbox: Failed to create domain: internal error
> Process exited while reading console log output: char device
> redirected to /dev/pts/1
> char device redirected to /dev/pts/3
> Virtio-9p Failed to initialize fs-driver with id:fsdev-fs1 and export
> path:libvirt-sandbox/test123/config
> 
> It appears when running as root because of the following line:
> ./libvirt-sandbox/libvirt-sandbox-context.c:    cachedir = (getuid() ? g_get_user_cache_dir() : RUNDIR);
> 
> RUNDIR is always "" due to being compiled with -DRUNDIR=\"\" . This is because there's a typo in makefile.am
> 
> Both of these are fixed in the diff attachment.

Thanks for your patch, I have confirmed the two fixes are correct. Before
pushing it though, I split it into 2 separate patches, since the 2 issues
are unrelated, so you'll see the following in GIT:

  commit 0f07878acb419eec6a7d36bae3d177868418b3f0
  Author: Radu Caragea <sinaelgl at gmail.com>
  Date:   Tue Jun 12 13:11:39 2012 +0100

    Avoid finding kernel modules multiple times
    
    Revert the first hunk from
    
     commit 05fb94d2c42abe9cfd86c3663d704c268f325503
     Author: Daniel P. Berrange <berrange at redhat.com>
     Date:   Wed Apr 4 16:30:49 2012 +0100
    
        Search kernel module dirs & fix mem leaks
    
    The change to remove '/kernel' from the module directory
    was bogus. The real fix was in the Fedora kernel RPM
    packaging
    
    Without the '/kernel' suffix, the same module might be
    found multiple times. eg When /lib/modules/`uname -r`/
    has symlinks to the compiled sources (through /build and
    /source) it crashed virt-sandbox with the error:
    
       "Unable to start sandbox: Error opening file
       '/tmp/libvirt-sandbox-9ivpRN/9pnet.ko': File exists"

  commit ee731cf288618c5d12e143b40d5c20eab7414fb4
  Author: Radu Caragea <sinaelgl at gmail.com>
  Date:   Tue Jun 12 13:09:45 2012 +0100

    Fix typo in Makefile.am  s/RUNDIR/rundir/

    The compiler flags use -DRUNDIR="$(rundir)", but the variable
    being set was RUNDIR, which resulted in a bogus relative
    path being used in the XML for the cachedir location.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list