Add CPU configuration.
This commit is contained in:
parent
c6bf6acb18
commit
11452babe6
3 changed files with 44 additions and 1 deletions
|
|
@ -46,4 +46,17 @@
|
|||
# "maximumRam": "512M"
|
||||
# "currentRam": "512M"
|
||||
|
||||
# CPU settings
|
||||
# "cpuModel": "host"
|
||||
# Setting maximumCpus to 1 omits the "-smp" options. The defaults (0)
|
||||
# cause the corresponding property to be omitted from the "-smp" option.
|
||||
# If currentCpus is greater than maximumCpus, the latter is adjusted.
|
||||
# "maximumCpus": 1
|
||||
# "currentCpus": 1
|
||||
# "cpuSockets": 0
|
||||
# "diesPerSocket": 0
|
||||
# "coresPerSocket": 0
|
||||
# "threadsPerCore": 0
|
||||
# "accelertor": "kvm"
|
||||
|
||||
|
||||
|
|
@ -61,6 +61,14 @@ class Configuration implements Dto {
|
|||
public String bootMode = "uefi";
|
||||
public String maximumRam;
|
||||
public String currentRam;
|
||||
public String cpuModel = "host";
|
||||
public int maximumCpus = 1;
|
||||
public int currentCpus = 1;
|
||||
public int cpuSockets;
|
||||
public int diesPerSocket;
|
||||
public int coresPerDie;
|
||||
public int threadsPerCore;
|
||||
public String accelerator = "kvm";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -80,6 +88,11 @@ class Configuration implements Dto {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Adjust max cpus if necessary
|
||||
if (vm.currentCpus > vm.maximumCpus) {
|
||||
vm.maximumCpus = vm.currentCpus;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,23 @@
|
|||
# Provide RAM
|
||||
- [ "-object", "memory-backend-ram,id=pc.ram,\
|
||||
size=${ vm.maximumRam!"512M" }" ]
|
||||
<#if vm.useTpm>
|
||||
# Attach TPM
|
||||
- [ "-chardev", "socket,id=chrtpm,path=${ runtimeDir }/swtpm-sock" ]
|
||||
- [ "-tpmdev", "emulator,id=tpm0,chardev=chrtpm" ]
|
||||
- [ "-device", "tpm-tis,tpmdev=tpm0" ]
|
||||
</#if>
|
||||
- [ "-cpu", "${ vm.cpuModel }" ]
|
||||
<#if vm.maximumCpus gt 1>
|
||||
- [ "-smp", "${ vm.currentCpus },maxcpus=${ vm.maximumCpus }\
|
||||
<#if vm.cpuSockets gt 0>,sockets=${ vm.cpuSockets }</#if>\
|
||||
<#if vm.diesPerSocket gt 0>,cores=${ vm.diesPerSocket }</#if>\
|
||||
<#if vm.coresPerDie gt 0>,cores=${ vm.coresPerDie }</#if>\
|
||||
<#if vm.threadsPerCore gt 0>,cores=${ vm.threadsPerCore }</#if>" ]
|
||||
</#if>
|
||||
<#if vm.accelerator != "none">
|
||||
- [ "-accel", "${ vm.accelerator }"]
|
||||
</#if>
|
||||
|
||||
- [ "-chardev", "socket,id=charmonitor,path=${ runtimeDir }/monitor.sock,server=on,wait=off" ]
|
||||
- [ "-mon", "chardev=charmonitor,id=monitor,mode=control" ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue