[libvirt] [sandbox][PATCH] Add module directory prefix selection feature

Daniel P. Berrange berrange at redhat.com
Tue Jun 19 15:31:41 UTC 2012


On Tue, Jun 19, 2012 at 01:33:40PM +0300, Radu Caragea wrote:
> Add module directory prefix selection feature
> 
> This is useful when running as a non-privileged user if we want to
> boot a custom compiled kernel: we might not have rights to install in
> /lib/modules/<kernel release> so when compiling the kernel we can use
> "make modules_install INSTALL_MOD_PATH=/path" which installs in
> /path/lib/modules/<kernel release>. By setting with
> gvir_sandbox_config_set_moddirprefix(cfg, "/path") we can now achieve
> just that.

>  libvirt-sandbox/libvirt-sandbox-builder-initrd.c  |    3 +-
>  libvirt-sandbox/libvirt-sandbox-builder-machine.c |    1 +
>  libvirt-sandbox/libvirt-sandbox-config-initrd.c   |   50 ++++++++++++++++
>  libvirt-sandbox/libvirt-sandbox-config-initrd.h   |    3 +
>  libvirt-sandbox/libvirt-sandbox-config.c          |   63 +++++++++++++++++++++
>  libvirt-sandbox/libvirt-sandbox-config.h          |    3 +
>  libvirt-sandbox/libvirt-sandbox.sym               |    3 +
>  7 files changed, 125 insertions(+), 1 deletions(-)
> 
> diff --git a/libvirt-sandbox/libvirt-sandbox-builder-initrd.c b/libvirt-sandbox/libvirt-sandbox-builder-initrd.c
> index dd01c7a..0b13589 100644
> --- a/libvirt-sandbox/libvirt-sandbox-builder-initrd.c
> +++ b/libvirt-sandbox/libvirt-sandbox-builder-initrd.c
> @@ -331,7 +331,8 @@ static GList *gvir_sandbox_builder_initrd_find_modules(GList *modnames,
>                                                         GVirSandboxConfigInitrd *config,
>                                                         GError **error)
>  {
> -    gchar *moddirpath = g_strdup_printf("/lib/modules/%s/kernel",
> +    gchar *moddirpath = g_strdup_printf("%s/lib/modules/%s/kernel",
> +                                        gvir_sandbox_config_initrd_get_moddirprefix(config),

I tend to think it would be more flexible, if instead of just the prefix, we
used the API to set the base module dir, eg

   gvir_sandbox_config_initrd_set_moduledir("/lib/modules");
   gvir_sandbox_config_initrd_set_moduledir("/some/other/prefix/lib/modules");
   gvir_sandbox_config_initrd_set_moduledir("/some/other/dir")

and then just append the version string to that.

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