]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Fix: increase the maximum number of shared folders
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 20 Sep 2024 00:25:21 +0000 (21:25 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 20 Sep 2024 00:25:21 +0000 (21:25 -0300)
kvmx

diff --git a/kvmx b/kvmx
index ab599f5ce0c390a1a171525ad352215498227686..8b5f6660b63f01f43b2cb871257d9287cfc13f4e 100755 (executable)
--- a/kvmx
+++ b/kvmx
@@ -411,9 +411,18 @@ function kvmx_up {
     # See http://wiki.qemu-project.org/Documentation/9psetup
     local shared="-fsdev local,id=shared,path=$shared_folder,security_model=none -device virtio-9p-pci,fsdev=shared,mount_tag=shared"
   elif [ ! -z "$shared_folders" ]; then
+    # Add a PCI bus for shared filesystems
+    # See https://www.qemu.org/docs/master/system/device-emulation.html
+    #     https://www.suse.com/support/kb/doc/?id=000019383
+    #     https://unix.stackexchange.com/questions/588912/add-more-pci-slots-to-virtual-machine
+    #
+    # Perhaps could also be implemented with the PXB (PCI Expander Bridge):
+    # https://github.com/qemu/qemu/blob/master/docs/pci_expander_bridge.txt
+    local shared_bus="-device pci-bridge,bus=pci.0,addr=5,chassis_nr=1,id=shared.0"
+
     local old_ifs="$IFS"
     local shared_item
-    local shared
+    local shared="$shared_bus"
     IFS=","
     for shared_item in $shared_folders; do
       local id="`echo $shared_item | cut -d ':' -f 1`"
@@ -431,7 +440,7 @@ function kvmx_up {
       mkdir -p $shared_folder
       shared_folder="`cd $KVMX_PROJECT_FOLDER && cd $shared_folder &> /dev/null && pwd`"
 
-      shared="$shared -fsdev local,id=$id,path=$shared_folder,security_model=none${shared_folder_mode} -device virtio-9p-pci,fsdev=$id,mount_tag=$id"
+      shared="$shared -fsdev local,id=$id,path=$shared_folder,security_model=none${shared_folder_mode} -device virtio-9p-pci,fsdev=$id,mount_tag=$id,bus=shared.0"
 
       unset shared_folder
       unset shared_folder_mountpoint