1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

B OpenNebula/one#5086: Add fuse support (#541)

This commit solves issues with creating new VM images based on the
docker images inside a container environment.

If fuse2fs command is present then prefer its use instead of the default
mount command which will work only under root or otherwise privileged
user.

This commit solves the mounting issue inside the rootless container
environment.

Also add a new environment file to the oned supervisord service so we
can start oned process with some additional env. variables - notably
DOCKER_HOST.

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>
This commit is contained in:
Petr Ospalý 2020-12-10 17:30:27 +01:00 committed by GitHub
parent 6df1cd1702
commit bb0b4aa526
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View File

@ -40,6 +40,7 @@ msg "Database is running - continue"
for envfile in \
/var/run/one/ssh-agent.env \
/etc/sysconfig/oned \
;
do
if [ -f "$envfile" ] ; then

View File

@ -46,7 +46,13 @@ esac
#-------------------------------------------------------------------------------
# Mount container disk image and untar rootfs contents to it
#-------------------------------------------------------------------------------
mount $tmp_dir/$id.raw $tmp_dir/$id
# try first to mount with the fuse2fs command and if that fails fallback to the
# regular mount
if ! fuse2fs -o noexec,nodev,nosuid $tmp_dir/$id.raw $tmp_dir/$id >/dev/null 2>&1 ; then
mount -o noexec,nodev,nosuid $tmp_dir/$id.raw $tmp_dir/$id
fi
chown $USER:$GROUP $tmp_dir/$id
tar $untar_options $tmp_dir/$id.$extension -C $tmp_dir/$id > /dev/null 2>&1

View File

@ -59,7 +59,13 @@ fi
trap clean EXIT
# Mount container disk image and untar rootfs contents to it
mount -o noexec,nodev,nosuid $img_raw $dockerdir/mnt > /dev/null 2>&1
# try first to mount with the fuse2fs command and if that fails fallback to the
# regular mount
if ! fuse2fs -o noexec,nodev,nosuid $img_raw $dockerdir/mnt >/dev/null 2>&1 ; then
mount -o noexec,nodev,nosuid $img_raw $dockerdir/mnt
fi
chmod o+w $dockerdir/mnt
tar xpf $tarball -C $dockerdir/mnt > /dev/null 2>&1