Skip to content

Commit

Permalink
incusd/instance/qemu/agent-loader: Remove virtiofs
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
  • Loading branch information
stgraber committed Jan 24, 2024
1 parent 967505f commit 994a72e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
8 changes: 2 additions & 6 deletions internal/server/instance/drivers/agent-loader/incus-agent
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ PREFIX="/run/incus_agent"
mkdir -p "${PREFIX}/.mnt"

# Functions.
mount_virtiofs() {
mount -t virtiofs agent "${PREFIX}/.mnt" -o ro >/dev/null 2>&1
}

mount_9p() {
modprobe 9pnet_virtio >/dev/null 2>&1 || true
mount -t 9p agent "${PREFIX}/.mnt" -o ro,access=0,trans=virtio,size=1048576 >/dev/null 2>&1
}

# Mount the agent share.
mount_virtiofs || mount_9p || fail "Couldn't mount virtiofs or 9p, failing."
mount_9p || fail "Couldn't mount 9p, failing."

# Transfer the agent binary.
rm -f "${PREFIX}/incus-agent"
Expand All @@ -24,4 +20,4 @@ umount "${PREFIX}/.mnt"
rmdir "${PREFIX}/.mnt"

# Re-exec the agent.
exec "${PREFIX}/incus-agent" "$@"
exec "${PREFIX}/incus-agent" "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ set -eu
PREFIX="/run/incus_agent"

# Functions.
mount_virtiofs() {
mount -t virtiofs config "${PREFIX}/.mnt" -o ro >/dev/null 2>&1
}

mount_9p() {
modprobe 9pnet_virtio >/dev/null 2>&1 || true
mount -t 9p config "${PREFIX}/.mnt" -o ro,access=0,trans=virtio,size=1048576 >/dev/null 2>&1
Expand All @@ -26,7 +22,7 @@ mount -t tmpfs tmpfs "${PREFIX}" -o mode=0700,nodev,nosuid,noatime,size=25M
mkdir -p "${PREFIX}/.mnt"

# Try virtiofs first.
mount_virtiofs || mount_9p || fail "Couldn't mount virtiofs or 9p, failing."
mount_9p || fail "Couldn't mount 9p, failing."

# Copy the data.
cp -Ra --no-preserve=ownership "${PREFIX}/.mnt/"* "${PREFIX}"
Expand Down

0 comments on commit 994a72e

Please sign in to comment.