From c76817393fc9442d29ef359e6b60b9d028e5f10c Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Tue, 23 Oct 2007 22:28:06 +0000 Subject: Implementing loopback container on NFS for the VMware *.vmem problem ... git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1398 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initramfs/initrd-stuff/bin/servconfig | 29 ++++++++++++++++++----------- initramfs/initrd-stuff/etc/functions | 19 ++++++++++++++----- 2 files changed, 32 insertions(+), 16 deletions(-) (limited to 'initramfs') diff --git a/initramfs/initrd-stuff/bin/servconfig b/initramfs/initrd-stuff/bin/servconfig index 0a0c14f0..f6c1fd8e 100755 --- a/initramfs/initrd-stuff/bin/servconfig +++ b/initramfs/initrd-stuff/bin/servconfig @@ -470,18 +470,25 @@ if [ -n "$scratch" -a -z "$tmpisdisk" ] ; then : ;; *) - tmpserv=$(uri_token $scratch server) - tmppath=$(uri_token $scratch path) - # hanging mount processes might stop further setup - timeout - # should be configured ... it is possible to mount "nolock" only - mount -t nfs -o rw,tcp,nolock,intr,nodev,soft,timeo=2,nosuid \ - ${tmpserv}:${tmppath} /tmp/scratch >/dev/null 2>&1 && { - testmkd /tmp/scratch/${clientip} - umount /tmp/scratch - # no need for tempfs there ... - umount /mnt/tmp >/dev/null 2>&1 + tmpserv=$(uri_token $scratch server) + tmppath=$(uri_token $scratch path) + # hanging mount processes might stop further setup - timeout + # should be configured ... it is possible to mount "nolock" only mount -t nfs -o rw,tcp,nolock,intr,nodev,soft,timeo=2,nosuid \ - ${tmpserv}:${tmppath}/${clientip} /mnt/tmp >/dev/null 2>&1; } + ${tmpserv}:${tmppath} /tmp/scratch >/dev/null 2>&1 && { + testmkd /tmp/scratch/${clientip} + umount /tmp/scratch + # no need for tempfs there ... + umount /mnt/tmp >/dev/null 2>&1 + mount -t nfs -o rw,tcp,nolock,intr,nodev,soft,timeo=2,nosuid \ + ${tmpserv}:${tmppath}/${clientip} /mnt/tmp >/dev/null 2>&1 + # create an empty container file for vmware *.vmem, it does not + # like to live on NFS exports + if [ "x$vmware" != "x" ] && [ "x$vmware" != "xno" ] ; then + dd if=/dev/zero of=/mnt/tmp/vm-container count=1 seek=204800 + diskfm /mnt/tmp/vm-container /mnt/tmp/vmware + chmod a+rwxt /mnt/tmp/vmware + fi; } ;; esac fi diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions index 5a65ff88..a2781bed 100644 --- a/initramfs/initrd-stuff/etc/functions +++ b/initramfs/initrd-stuff/etc/functions @@ -214,9 +214,12 @@ return $notfound } ############################################################################# # disk formatter and mounter. some proper error message output should be -# added. It uses programs invoked from stage 4 root filesystem +# added. It uses programs invoked from stage 4 root filesystem. First +# argument is blockdev or file to be formatted, second mountpoint if not +# /mnt/tmp (default) diskfm () { local target=$1 +local mntpnt=$2 local fs local path for fs in xfs ext2 reiserfs ; do @@ -241,11 +244,17 @@ for fs in xfs ext2 reiserfs ; do esac LD_LIBRARY_PATH=/mnt/lib /mnt/$path/mkfs.$fs $fopt $target \ >/dev/null 2>&1 #|| error - umount /mnt/tmp 2>/dev/null - if mount -t $fs -n $mopt $target /mnt/tmp 2>/dev/null; then - return 0 + if [ -z $mntpnt ] ; then + umount /mnt/tmp 2>/dev/null + if mount -t $fs -n $mopt $target /mnt/tmp 2>/dev/null; then + return 0 + else + mount -n -t tmpfs none /mnt/tmp + fi else - mount -n -t tmpfs none /mnt/tmp + testmkd $mntpnt + mount -t $fs -n -o loop $target $mntpnt 2>/dev/null + return 0 fi fi done -- cgit v1.2.3-55-g7522