mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 16:57:18 +00:00
virtcontainers: support vm factory in QEMU 4
Turn off VMX if vm-factory is enabled since it's not migratable yet. see https://bugzilla.redhat.com/show_bug.cgi?id=1689216 fixes #1747 Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
3d8803bb86
commit
b780c160da
@ -17,6 +17,8 @@ import (
|
||||
type qemuAmd64 struct {
|
||||
// inherit from qemuArchBase, overwrite methods if needed
|
||||
qemuArchBase
|
||||
|
||||
vmFactory bool
|
||||
}
|
||||
|
||||
const defaultQemuPath = "/usr/bin/qemu-system-x86_64"
|
||||
@ -89,8 +91,13 @@ func newQemuArch(config HypervisorConfig) qemuArch {
|
||||
machineType = defaultQemuMachineType
|
||||
}
|
||||
|
||||
factory := false
|
||||
if config.BootToBeTemplate || config.BootFromTemplate {
|
||||
factory = true
|
||||
}
|
||||
|
||||
q := &qemuAmd64{
|
||||
qemuArchBase{
|
||||
qemuArchBase: qemuArchBase{
|
||||
machineType: machineType,
|
||||
memoryOffset: config.MemOffset,
|
||||
qemuPaths: qemuPaths,
|
||||
@ -99,6 +106,7 @@ func newQemuArch(config HypervisorConfig) qemuArch {
|
||||
kernelParamsDebug: kernelParamsDebug,
|
||||
kernelParams: kernelParams,
|
||||
},
|
||||
vmFactory: factory,
|
||||
}
|
||||
|
||||
q.handleImagePath(config)
|
||||
@ -129,6 +137,14 @@ func (q *qemuAmd64) cpuModel() string {
|
||||
if q.nestedRun {
|
||||
cpuModel += ",pmu=off"
|
||||
}
|
||||
|
||||
// VMX is not migratable yet.
|
||||
// issue: https://github.com/kata-containers/runtime/issues/1750
|
||||
if q.vmFactory {
|
||||
virtLog.WithField("subsystem", "qemuAmd64").Warn("VMX is not migratable yet: turning it off")
|
||||
cpuModel += ",vmx=off"
|
||||
}
|
||||
|
||||
return cpuModel
|
||||
}
|
||||
|
||||
|
@ -78,6 +78,14 @@ func TestQemuAmd64CPUModel(t *testing.T) {
|
||||
expectedOut = defaultCPUModel + ",pmu=off"
|
||||
model = amd64.cpuModel()
|
||||
assert.Equal(expectedOut, model)
|
||||
|
||||
amd64.disableNestingChecks()
|
||||
base, ok := amd64.(*qemuAmd64)
|
||||
assert.True(ok)
|
||||
base.vmFactory = true
|
||||
expectedOut = defaultCPUModel + ",vmx=off"
|
||||
model = amd64.cpuModel()
|
||||
assert.Equal(expectedOut, model)
|
||||
}
|
||||
|
||||
func TestQemuAmd64MemoryTopology(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user