]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Switch to 'mapped' access mode for hostfs
authorReto Buerki <reet@codelabs.ch>
Wed, 16 Jan 2013 10:58:01 +0000 (11:58 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 17 Jan 2013 15:55:04 +0000 (16:55 +0100)
Passthrough mode only works as expected when running as root. On
Debian/Ubuntu systems qemu runs as user 'libvirt-qemu' and group 'kvm'
so all shared files must be chowned to grant access from guests.

Symlinks created on the host are still problematic because the Plan 9
filesystem has no direct notion of symbolic links, see [1].

[1] - http://ericvh.github.com/9p-rfc/rfc9p2000.u.html

14 files changed:
testing/config/kvm/alice.xml
testing/config/kvm/bob.xml
testing/config/kvm/carol.xml
testing/config/kvm/dave.xml
testing/config/kvm/moon.xml
testing/config/kvm/sun.xml
testing/config/kvm/venus.xml
testing/config/kvm/winnetou.xml
testing/hosts/default/etc/fstab
testing/make-testing
testing/scripts/build-guestkernel
testing/scripts/build-rootimage
testing/start-testing
testing/testing.conf

index 21683b878b9c5452e4fac0f1257e030b587dc100..6ca78f8619287679ed463249637549ae8c0cdf7b 100644 (file)
@@ -30,7 +30,7 @@
     <controller type='usb' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>
-    <filesystem type='mount' accessmode='passthrough'>
+    <filesystem type='mount' accessmode='mapped'>
       <source dir='/var/run/kvm-swan-hostfs'/>
       <target dir='/hostshare'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
index e112008025a7c76b6a0e7205bfff927fa1807dae..d9a9b4c051ef87dda30bc4dffbe3faa087f348af 100644 (file)
@@ -30,7 +30,7 @@
     <controller type='usb' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>
-    <filesystem type='mount' accessmode='passthrough'>
+    <filesystem type='mount' accessmode='mapped'>
       <source dir='/var/run/kvm-swan-hostfs'/>
       <target dir='/hostshare'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
index 3bd66f14100a101e7eba5c2b419bd209e272b071..fbdabe2e4253981b9018a5cf527605b7e45a90ee 100644 (file)
@@ -30,7 +30,7 @@
     <controller type='usb' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>
-    <filesystem type='mount' accessmode='passthrough'>
+    <filesystem type='mount' accessmode='mapped'>
       <source dir='/var/run/kvm-swan-hostfs'/>
       <target dir='/hostshare'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
index 526df285a90f3b4c1d739d1e62374bc9a6f9b8a7..bfebe9b608089f611a96a5001fe3f1115654911f 100644 (file)
@@ -30,7 +30,7 @@
     <controller type='usb' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>
-    <filesystem type='mount' accessmode='passthrough'>
+    <filesystem type='mount' accessmode='mapped'>
       <source dir='/var/run/kvm-swan-hostfs'/>
       <target dir='/hostshare'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
index 04929931216687e88d7724763f04b6c150a2a75f..e019fcea5bc02dd60785e8a1d5ad9dd11ca129ce 100644 (file)
@@ -30,7 +30,7 @@
     <controller type='usb' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>
-    <filesystem type='mount' accessmode='passthrough'>
+    <filesystem type='mount' accessmode='mapped'>
       <source dir='/var/run/kvm-swan-hostfs'/>
       <target dir='/hostshare'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
index e60129819daf3d9e64058cb97d136331464255bc..5ed1a47eae0294eec258a045002b4da57e130e2a 100644 (file)
@@ -30,7 +30,7 @@
     <controller type='usb' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>
-    <filesystem type='mount' accessmode='passthrough'>
+    <filesystem type='mount' accessmode='mapped'>
       <source dir='/var/run/kvm-swan-hostfs'/>
       <target dir='/hostshare'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
index bd00aa563096a51d232085fae7a9d0a3d569be7c..77a333655f29cfec64a98fee49e01d500e5148d8 100644 (file)
@@ -30,7 +30,7 @@
     <controller type='usb' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>
-    <filesystem type='mount' accessmode='passthrough'>
+    <filesystem type='mount' accessmode='mapped'>
       <source dir='/var/run/kvm-swan-hostfs'/>
       <target dir='/hostshare'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
index a23b2489c04cbb7676ae21a69c74245983810702..99d5deb99a13b8b930224dd2bf45e6afdde1fe3b 100644 (file)
@@ -30,7 +30,7 @@
     <controller type='usb' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>
-    <filesystem type='mount' accessmode='passthrough'>
+    <filesystem type='mount' accessmode='mapped'>
       <source dir='/var/run/kvm-swan-hostfs'/>
       <target dir='/hostshare'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
index 1fb00f42ead6a53b936af2296c54d676f3971281..12747232e19961196960cec5a4d412a04f9f591a 100644 (file)
@@ -1 +1 @@
-/hostshare /hostfs 9p trans=virtio,version=9p2000.L 0 0
+/hostshare /root/shared 9p trans=virtio,version=9p2000.L 0 0
index cac4eddf86f33b3e150ad6f57523df5a4fc2a176..84ac20bf2f2bea626df536dbb35d139638ee2d6a 100755 (executable)
@@ -4,6 +4,7 @@ DIR=$(dirname `readlink -f $0`)
 . $DIR/testing.conf
 
 rm -f $LOGFILE
+mkdir -p $BUILDDIR
 
 if [ $ENABLE_BUILD_BASEIMAGE = "yes" ]
 then
index fdd19ac74f1b3289fdcb3069d1c7aaff36b6d093..66a9fe7a4b0208c78ee103165b350309c50de1f3 100755 (executable)
@@ -10,7 +10,6 @@ echo "Building guest kernel version $KERNELVERSION"
 
 check_commands bunzip2 bzcat make wget
 
-mkdir -p $BUILDDIR
 cd $BUILDDIR
 
 if [ ! -f "$KERNELTARBALL" ]
index 8f2b3aa1c09b82fa7a6febfb1fbfeb9a8edd5b66..8e10ce5f3ad7ff39160f2057077fa643ecf4728f 100755 (executable)
@@ -28,7 +28,7 @@ check_commands partprobe qemu-img qemu-nbd
 load_qemu_nbd
 
 mkdir -p $LOOPDIR
-mkdir -p $ROOTIMGCOMPILEDIR
+mkdir -p $SHAREDDIR/compile
 mkdir -p $IMGDIR
 
 log_action "Creating root image $ROOTIMG"
@@ -47,24 +47,21 @@ log_action "Mounting proc filesystem to $LOOPDIR/proc"
 execute "mount -t proc none $LOOPDIR/proc"
 do_on_exit umount $LOOPDIR/proc
 
-mkdir -p $LOOPDIR/root/compile
-log_action "Mounting $ROOTIMGCOMPILEDIR as /root/compile"
-execute "mount -o bind $ROOTIMGCOMPILEDIR $LOOPDIR/root/compile"
-do_on_exit rm -r $LOOPDIR/root/compile
-do_on_exit umount $LOOPDIR/root/compile
+mkdir -p $LOOPDIR/root/shared
+log_action "Mounting $SHAREDDIR as /root/shared"
+execute "mount -o bind $SHAREDDIR $LOOPDIR/root/shared"
+do_on_exit umount $LOOPDIR/root/shared
 
 echo "Installing software from source"
 RECPDIR=$DIR/recipes
 RECIPES=`ls $RECPDIR/*.mk | xargs -n1 basename`
-execute "cp -r $RECPDIR/patches $LOOPDIR/root/compile" 0
+execute "cp -r $RECPDIR/patches $LOOPDIR/root/shared/compile" 0
 for r in $RECIPES
 do
-       cp $RECPDIR/$r ${LOOPDIR}/root/compile
+       cp $RECPDIR/$r ${LOOPDIR}/root/shared/compile
        log_action "Installing from recipe $r"
-       execute_chroot "make SWANVERSION=$SWANVERSION -C /root/compile -f $r"
+       execute_chroot "make SWANVERSION=$SWANVERSION -C /root/shared/compile -f $r"
 done
 
 log_action "Removing /etc/resolv.conf"
 execute "rm -f $LOOPDIR/etc/resolv.conf"
-
-mkdir -p $LOOPDIR/hostfs
index e4e00bb1b61d64d13a07dc5c0e3357775e692a04..9be1f8619b0e1290b1da4a173ac0c646746d84be 100755 (executable)
@@ -19,8 +19,9 @@ check_commands virsh
 log_action "Deploying kernel $KERNEL"
 execute "ln -fs $KNLSRC $KNLTARGET"
 
-log_action "Deploying $ROOTIMGCOMPILEDIR as hostfs"
-execute "ln -Tfs $ROOTIMGCOMPILEDIR $HOSTFSTARGET"
+log_action "Deploying $SHAREDDIR as hostfs"
+execute "chown -R $KVMUSER:$KVMGROUP $SHAREDDIR" 0
+execute "ln -Tfs $SHAREDDIR $HOSTFSTARGET"
 
 for net in $NETWORKS
 do
index b8bd3cf1bc42ebe51d5f277492f4685d73969deb..960d3f63e98d0e204a16219a0193e12f5c578fca 100644 (file)
@@ -29,6 +29,8 @@ SWANVERSION=5.0.2dr4
 
 # Build directory where the guest kernel and images will be built
 BUILDDIR=$TESTDIR/build
+# Directory shared between host and guests
+SHAREDDIR=$BUILDDIR/shared
 
 # Logfile
 LOGFILE=$BUILDDIR/testing.log
@@ -52,12 +54,13 @@ BASEIMGMIRROR=http://cdn.debian.net/debian
 # The root image is the origin of all guest images. It is a clone of the base
 # image and contains additional test-specific software and patches.
 ROOTIMG=$IMGDIR/root.$IMGEXT
-ROOTIMGCOMPILEDIR=$BUILDDIR/compile
 
 # libvirt config
 NBDEV=/dev/nbd0
 NBDPARTITION=${NBDEV}p1
 VIRTIMGSTORE=/var/lib/libvirt/images
+KVMUSER=libvirt-qemu
+KVMGROUP=kvm
 
 # Directory where test results will be stored
 TESTRESULTSDIR=$TESTDIR/testresults