civodul pushed a commit to branch master
in repository guix.

commit 9939677d15592acb8663162af8eab3d33f4831db
Author: Ludovic Courtès <[email protected]>
AuthorDate: Sat Feb 22 11:11:36 2025 +0100

    vm: ‘common-qemu-options’ splits command-line tokens.
    
    The result returned so far by ‘common-qemu-options’ assumed that it
    would be passed to a shell.  This is the case when using
    ‘system-qemu-image/shared-store-script’ but possibly not in other cases.
    
    * gnu/system/vm.scm (common-qemu-options): Add #:image-format.
    [virtfs-option]: Return a list of strings instead of a single
    "-virtfs xyz" string.  Update caller to use ‘append-map’.
    Separate "-drive" string.
    
    Change-Id: Ib07c27e2c4b2d222d7db2c612bb045d330bc7f68
---
 gnu/system/vm.scm | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 1e3f72c7b2..dbfe873e4f 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013-2024 Ludovic Courtès <[email protected]>
+;;; Copyright © 2013-2025 Ludovic Courtès <[email protected]>
 ;;; Copyright © 2016 Christine Lemmer-Webber <[email protected]>
 ;;; Copyright © 2016, 2017 Leo Famulari <[email protected]>
 ;;; Copyright © 2017 Mathieu Othacehe <[email protected]>
@@ -211,14 +211,16 @@ environment with the store shared with the host.  
MAPPINGS is a list of
 
 (define* (common-qemu-options image shared-fs
                               #:key
+                              (image-format "raw")
                               rw-image?
                               (target (%current-target-system)))
   "Return the a string-value gexp with the common QEMU options to boot IMAGE,
 with '-virtfs' options for the host file systems listed in SHARED-FS."
 
   (define (virtfs-option fs)
-    #~(format #f "-virtfs local,path=~s,security_model=none,mount_tag=~s"
-              #$fs #$(file-system->mount-tag fs)))
+    #~("-virtfs"
+       (format #f "local,path=~a,security_model=none,mount_tag=~a"
+               #$fs #$(file-system->mount-tag fs))))
 
   #~(;; Only enable kvm if we see /dev/kvm exists.
      ;; This allows users without hardware virtualization to still use these
@@ -230,11 +232,12 @@ with '-virtfs' options for the host file systems listed 
in SHARED-FS."
      "-object" "rng-random,filename=/dev/urandom,id=guix-vm-rng"
      "-device" "virtio-rng-pci,rng=guix-vm-rng"
 
-     #$@(map virtfs-option shared-fs)
-     #$@(if rw-image?
-            #~((format #f "-drive file=~a,format=qcow2,if=virtio" #$image))
-            #~((format #f "-drive 
file=~a,format=raw,if=virtio,cache=writeback,werror=report,readonly=on"
-                       #$image)))))
+     #$@(append-map virtfs-option shared-fs)
+     "-drive"
+     #$(if rw-image?
+           #~(format #f "file=~a,format=qcow2,if=virtio" #$image)
+           #~(format #f 
"file=~a,format=~a,if=virtio,cache=writeback,werror=report,readonly=on"
+                     #$image #$image-format))))
 
 (define* (system-qemu-image/shared-store-script os
                                                 #:key

Reply via email to