Add support for virtio-9p

This commit is contained in:
Martin Wimpress 2021-09-29 03:30:16 +01:00
parent d63a57a26f
commit 01fca96f28
No known key found for this signature in database
GPG key ID: 61DF940515E06DA3
2 changed files with 21 additions and 2 deletions

View file

@ -467,6 +467,17 @@ function vm_boot() {
if [ "${guest_os}" != "macos" ]; then
echo " - WebDAV: ${PUBLIC} via: dav://localhost:9843/"
fi
if [ "${guest_os}" != "windows" ]; then
echo -n " - 9P: ${PUBLIC} via: "
if [ "${guest_os}" == "linux" ]; then
echo "sudo mount -t 9p -o trans=virtio,version=9p2000.L,msize=104857600 ${USER}-public ~/Public"
elif [ "${guest_os}" == "macos" ]; then
# PUBLICSHARE needs to be world writeable for seamless integration with
# macOS. Test if it is is world writeable, and prompt what to do if not.
echo "sudo mount_9p ${USER}-public"
fi
fi
fi
enable_usb_passthrough
@ -565,6 +576,14 @@ function vm_boot() {
-object rng-random,id=rng0,filename=/dev/urandom)
fi
# https://wiki.qemu.org/Documentation/9psetup
# https://askubuntu.com/questions/772784/9p-libvirt-qemu-share-modes
if [ "${guest_os}" != "windows" ]; then
# shellcheck disable=SC2054
args+=(-fsdev local,id=fsdev0,path="${PUBLIC}",security_model=mapped-xattr
-device virtio-9p-pci,fsdev=fsdev0,mount_tag="${USER}-public")
fi
if [ -n "${USB_PASSTHROUGH}" ]; then
# shellcheck disable=SC2054,SC2206
args+=(-device ${USB_HOST_PASSTHROUGH_CONTROLLER},id=hostpass