mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-17 14:24:27 +01:00
qemu: add cpu_features option
[ port from runtime commit 0100af18a2afdd6dfcc95129ec6237ba4915b3e5 ] To control whether guest can enable/disable some CPU features. E.g. pmu=off, vmx=off. As discussed in the thread [1], the best approach is to let users specify them. How about adding a new option in the configuration file. Currently this patch only supports this option in qemu,no other vmm. [1] https://github.com/kata-containers/runtime/pull/2559#issuecomment-603998256 Signed-off-by: Jia He <justin.he@arm.com> Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
@@ -1604,6 +1604,53 @@ func TestDefaultMachineAccelerators(t *testing.T) {
|
||||
assert.Equal(machineAccelerators, h.machineAccelerators())
|
||||
}
|
||||
|
||||
func TestDefaultCPUFeatures(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
cpuFeatures := "abc,123,rgb"
|
||||
h := hypervisor{CPUFeatures: cpuFeatures}
|
||||
assert.Equal(cpuFeatures, h.cpuFeatures())
|
||||
|
||||
cpuFeatures = ""
|
||||
h.CPUFeatures = cpuFeatures
|
||||
assert.Equal(cpuFeatures, h.cpuFeatures())
|
||||
|
||||
cpuFeatures = "abc"
|
||||
h.CPUFeatures = cpuFeatures
|
||||
assert.Equal(cpuFeatures, h.cpuFeatures())
|
||||
|
||||
cpuFeatures = "abc,123"
|
||||
h.CPUFeatures = "abc,,123"
|
||||
assert.Equal(cpuFeatures, h.cpuFeatures())
|
||||
|
||||
cpuFeatures = "abc,123"
|
||||
h.CPUFeatures = ",,abc,,123,,,"
|
||||
assert.Equal(cpuFeatures, h.cpuFeatures())
|
||||
|
||||
cpuFeatures = "abc,123"
|
||||
h.CPUFeatures = "abc,,123,,,"
|
||||
assert.Equal(cpuFeatures, h.cpuFeatures())
|
||||
|
||||
cpuFeatures = "abc"
|
||||
h.CPUFeatures = ",,abc,"
|
||||
assert.Equal(cpuFeatures, h.cpuFeatures())
|
||||
|
||||
cpuFeatures = "abc"
|
||||
h.CPUFeatures = ", , abc , ,"
|
||||
assert.Equal(cpuFeatures, h.cpuFeatures())
|
||||
|
||||
cpuFeatures = "abc"
|
||||
h.CPUFeatures = " abc "
|
||||
assert.Equal(cpuFeatures, h.cpuFeatures())
|
||||
|
||||
cpuFeatures = "abc,123"
|
||||
h.CPUFeatures = ", abc , 123 ,"
|
||||
assert.Equal(cpuFeatures, h.cpuFeatures())
|
||||
|
||||
cpuFeatures = "abc,123"
|
||||
h.CPUFeatures = ",, abc ,,, 123 ,,"
|
||||
assert.Equal(cpuFeatures, h.cpuFeatures())
|
||||
}
|
||||
|
||||
func TestUpdateRuntimeConfiguration(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user