diff options
author | Oliver Tappe | 2009-03-20 13:28:32 +0100 |
---|---|---|
committer | Oliver Tappe | 2009-03-20 13:28:32 +0100 |
commit | 86463959539587187b098eb1762d2238d856587d (patch) | |
tree | c584e29ca154eb11fae48d5dedb736de0c876d11 /os-plugins | |
parent | Restructured disk/tmp setup to avoid unionfs/aufs hassles of covered (diff) | |
download | core-86463959539587187b098eb1762d2238d856587d.tar.gz core-86463959539587187b098eb1762d2238d856587d.tar.xz core-86463959539587187b098eb1762d2238d856587d.zip |
* in an attempt to solve #399 (and #398), we now mount the host's perl core
path into the vendor-OS before chrooting into it for every plugin, which
seems to solve the dynamic loading issue described in these two tickets
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2749 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins')
-rw-r--r-- | os-plugins/OpenSLX/OSPlugin/Engine.pm | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm index c5e6a99f..112a7683 100644 --- a/os-plugins/OpenSLX/OSPlugin/Engine.pm +++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm @@ -18,6 +18,7 @@ use warnings; our $VERSION = 1.01; # API-version . implementation-version +use Config; use File::Basename; use File::Path; use Storable; @@ -631,13 +632,18 @@ sub _callChrootedFunctionForPlugin # via other processes (which could cause problems) my $osSetupEngine = $self->_osSetupEngine(); - # bind-mount openslx basepath to /mnt/openslx of vendor-OS: + # prepare bind-mount of openslx base and config paths to /mnt of + # vendor-OS: my $basePath = $openslxConfig{'base-path'}; my $basePathInChroot = "$self->{'vendor-os-path'}/mnt/opt/openslx"; mkpath($basePathInChroot); my $configPath = $openslxConfig{'config-path'}; my $configPathInChroot = "$self->{'vendor-os-path'}/mnt/etc/opt/openslx"; mkpath($configPathInChroot); + # prepare bind-mount of host's perl corelib path to /mnt of vendor-OS: + my $hostPerlCorePath = $Config{privlibexp}; + my $hostPerlCorePathInChroot = "$self->{'vendor-os-path'}/mnt/host-perl"; + mkpath($hostPerlCorePathInChroot); my $pluginSession = OpenSLX::ScopedResource->new({ name => 'osplugin::session', @@ -655,17 +661,38 @@ sub _callChrootedFunctionForPlugin "unable to bind mount '%s' to '%s'! (%s)", $configPath, $configPathInChroot, $! ); + # Bind mount hosts perl core path into vendor-OS and add it to + # perl's search paths, in order to let dynamic loading of perl + # modules/scripts work. Currently, we hope that only the perl core + # path (privlibexp) is required for that, but we might have to + # mount the architecture dependent path (archlibexp) or the + # vendor perl paths (vendorlibexp and vendorarchexp), too. + slxsystem( + "mount -o bind -o ro $hostPerlCorePath $hostPerlCorePathInChroot" + ) == 0 + or die _tr( + "unable to bind mount '%s' to '%s'! (%s)", + $hostPerlCorePath, $hostPerlCorePathInChroot, $! + ); + unshift @INC, '/mnt/host-perl'; 1 }, release => sub { - slxsystem("umount $basePathInChroot") == 0 + if ($INC[0] eq '/mnt/host-perl') { + shift @INC; + } + slxsystem("umount $hostPerlCorePathInChroot") == 0 or die _tr( - "unable to umount '%s'! (%s)", $basePathInChroot, $! + "unable to umount '%s'! (%s)", $hostPerlCorePathInChroot, $! ); slxsystem("umount $configPathInChroot") == 0 or die _tr( "unable to umount '%s'! (%s)", $configPathInChroot, $! ); + slxsystem("umount $basePathInChroot") == 0 + or die _tr( + "unable to umount '%s'! (%s)", $basePathInChroot, $! + ); 1 }, }); |