F #5058: Context ISO creation w/a for FUSE mounts (#421)

This commit is contained in:
Vlastimil Holer authored and GitHub committed 2020-11-13 19:44:17 +01:00
1 parent cd73f8eb38
commit 63aa822dcd
1 file changed
+16 -3
+16 -3
View File
@@ -69,8 +69,11 @@ ISO_DIR="$DS_DIR/.isofiles/$VM_ID"
ISO_FILE="$VM_ID.iso"
ISO_PATH="$ISO_DIR/$ISO_FILE"
exec_and_log "rm -rf $ISO_DIR" \
"Could not delete temp. to make context dev"
exec_and_set_error "mkdir -p $ISO_DIR" \
"Could not create tmp dir to make context dev"
"Could not create temp. dir to make context dev"
[ -n "$ERROR" ] && exit_error
for f in "${SRC[@]}"; do
@@ -95,8 +98,18 @@ for f in "${SRC[@]}"; do
[ -n "$ERROR" ] && exit_error
done
exec_and_set_error "$MKISOFS -o $ISO_PATH -V CONTEXT -J -R $ISO_DIR" \
"Error creating iso fs"
# This generates context ISO first into a temporary file and renames to final
# file, to workaround problem when datastores are on FUSE mounted volume
# (e.g,. fuse-overlayfs), cached files metadata are not consistent and
# and tar sparse detection algorithm could identify file as empty.
MKCONTEXT_CMD=$(cat <<EOF
set -e -o pipefail
$MKISOFS -o $ISO_PATH.tmp -V CONTEXT -J -R $ISO_DIR
mv $ISO_PATH.tmp $ISO_PATH
EOF
)
multiline_exec_and_set_error "$MKCONTEXT_CMD" "Error creating iso fs"
[ -n "$ERROR" ] && exit_error
COPY_CMD=$(cat <<EOF