2023-05-25 12:00:44 +02:00
|
|
|
|
(define-module (glicid services virtualization)
|
|
|
|
|
#:use-module (gnu services)
|
|
|
|
|
#:use-module (gnu services shepherd)
|
2023-05-25 15:30:47 +02:00
|
|
|
|
#:use-module ((gnu services virtualization) #:prefix gnu)
|
|
|
|
|
#:use-module ((gnu packages virtualization) #:prefix gnu)
|
|
|
|
|
; #:use-module (guix records)
|
|
|
|
|
; #:use-module (guix utils)
|
|
|
|
|
#:use-module (guix gexp) ;; file-like?
|
|
|
|
|
#:use-module (gnu services configuration) ;; define-configuration
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#:export (qemu-guest-agent-service-type)
|
|
|
|
|
)
|
2023-05-25 12:00:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;
|
2023-05-25 15:30:47 +02:00
|
|
|
|
;;; Redef QEMU guest agent service.
|
2023-05-25 12:00:44 +02:00
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
|
2023-05-25 15:30:47 +02:00
|
|
|
|
|
|
|
|
|
;(define (serialize-field field-name val)
|
|
|
|
|
; (format #t "~a = ~a\n" (uglify-field-name field-name) val))
|
|
|
|
|
|
|
|
|
|
;(define (serialize-string field-name val)
|
|
|
|
|
; (serialize-field field-name (quote-val val)))
|
|
|
|
|
|
|
|
|
|
|
2023-05-25 12:00:44 +02:00
|
|
|
|
;;
|
|
|
|
|
|
2023-05-25 15:30:47 +02:00
|
|
|
|
;(define-configuration qemu-guest-agent-configuration
|
|
|
|
|
; (qemu
|
|
|
|
|
; (file-like gnu:qemu-minimal)
|
|
|
|
|
; "QEMU package.")
|
|
|
|
|
; (device
|
|
|
|
|
; (string "")
|
|
|
|
|
; "Path to device or socket used to communicate with the host. If not
|
|
|
|
|
;specified, the QEMU default path is used."))
|
|
|
|
|
|
|
|
|
|
;(define (qemu-guest-agent-shepherd-service config)
|
|
|
|
|
; (let ((qemu (qemu-guest-agent-configuration-qemu config))
|
|
|
|
|
; (device (qemu-guest-agent-configuration-device config)))
|
|
|
|
|
; (list
|
|
|
|
|
; (shepherd-service
|
|
|
|
|
; (provision '(qemu-guest-agent))
|
|
|
|
|
; (documentation "Run the QEMU guest agent.")
|
|
|
|
|
; (start #~(make-forkexec-constructor
|
|
|
|
|
; `(,(string-append #$qemu "/bin/qemu-ga")
|
|
|
|
|
; "--statedir" "/var/run"
|
|
|
|
|
; ,@(if (string-null? #$device)
|
|
|
|
|
; '()
|
|
|
|
|
; (list "--path" #$device)))
|
|
|
|
|
; #:log-file "/var/log/qemu-ga.log"))
|
|
|
|
|
; (stop #~(make-kill-destructor))))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;(define (qemu-guest-agent-shepherd-service config)
|
|
|
|
|
; (let ((qemu (qemu-guest-agent-configuration-qemu config))
|
|
|
|
|
; (device (qemu-guest-agent-configuration-device config)))
|
|
|
|
|
; (list
|
|
|
|
|
; (shepherd-service
|
|
|
|
|
; (provision '(qemu-guest-agent))
|
|
|
|
|
; (requirement '(udev)) ;; GLiCID
|
|
|
|
|
; (documentation "Run the QEMU guest agent.")
|
|
|
|
|
; (start #~(make-forkexec-constructor
|
|
|
|
|
; `(,(string-append #$qemu "/bin/qemu-ga")
|
|
|
|
|
; "--statedir" "/var/run"
|
|
|
|
|
; ,@(if (string-null? #$device)
|
|
|
|
|
; '()
|
|
|
|
|
; (list "--path" #$device)))
|
|
|
|
|
; #:log-file "/var/log/qemu-ga.log"))
|
|
|
|
|
; (stop #~(make-kill-destructor))))))
|
2023-05-25 12:00:44 +02:00
|
|
|
|
|
|
|
|
|
(define (qemu-guest-agent-shepherd-service config)
|
2023-05-25 15:30:47 +02:00
|
|
|
|
(inherit gnu:qemu-guest-agent-shepherd-service)
|
|
|
|
|
(requirement '(udev)) ;; GLiCID
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;(define qemu-guest-agent-service-type
|
|
|
|
|
; (service-type
|
|
|
|
|
; (name 'qemu-guest-agent)
|
|
|
|
|
; (extensions
|
|
|
|
|
; (list (service-extension shepherd-root-service-type
|
|
|
|
|
; qemu-guest-agent-shepherd-service)))
|
|
|
|
|
; (default-value (qemu-guest-agent-configuration))
|
|
|
|
|
; (description "Run the QEMU guest agent.")))
|