mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
vm: Add ‘cpu-count’ field to <virtual-machine>.
* gnu/system/vm.scm (<virtual-machine>)[cpu-count]: New field. (virtual-machine-compiler): Honor it. Change-Id: I907a89365f32ac7a9981c4ae5f59cf6eb199c3cc
This commit is contained in:
parent
7a4f585ae1
commit
b0a5c0742f
1 changed files with 8 additions and 1 deletions
|
@ -75,6 +75,7 @@ (define-module (gnu system vm)
|
|||
virtual-machine?
|
||||
virtual-machine-operating-system
|
||||
virtual-machine-qemu
|
||||
virtual-machine-cpu-count
|
||||
virtual-machine-volatile?
|
||||
virtual-machine-graphic?
|
||||
virtual-machine-memory-size
|
||||
|
@ -326,6 +327,8 @@ (define-record-type* <virtual-machine> %virtual-machine
|
|||
(operating-system virtual-machine-operating-system) ;<operating-system>
|
||||
(qemu virtual-machine-qemu ;<package>
|
||||
(default qemu-minimal))
|
||||
(cpu-count virtual-machine-cpu-count ;integer
|
||||
(default 1))
|
||||
(volatile? virtual-machine-volatile? ;Boolean
|
||||
(default #t))
|
||||
(graphic? virtual-machine-graphic? ;Boolean
|
||||
|
@ -363,7 +366,7 @@ (define (port-forwardings->qemu-options forwardings)
|
|||
(define-gexp-compiler (virtual-machine-compiler (vm <virtual-machine>)
|
||||
system target)
|
||||
(match vm
|
||||
(($ <virtual-machine> os qemu volatile? graphic? memory-size
|
||||
(($ <virtual-machine> os qemu cpus volatile? graphic? memory-size
|
||||
disk-image-size forwardings date)
|
||||
(let ((options
|
||||
(append (if (null? forwardings)
|
||||
|
@ -372,6 +375,10 @@ (define-gexp-compiler (virtual-machine-compiler (vm <virtual-machine>)
|
|||
"user,model=virtio-net-pci,"
|
||||
(port-forwardings->qemu-options
|
||||
forwardings))))
|
||||
(if (> cpus 1)
|
||||
`("-smp" ,(string-append "cpus="
|
||||
(number->string cpus)))
|
||||
'())
|
||||
(if date
|
||||
`("-rtc"
|
||||
,(string-append
|
||||
|
|
Loading…
Reference in a new issue