mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-09 12:49:12 +00:00
Merge pull request #4051 from bergwolf/github/vmx-vm-factory
enable vmx for vm factory
This commit is contained in:
@@ -38,14 +38,11 @@ const (
|
||||
|
||||
defaultQemuMachineOptions = "accel=kvm,kernel_irqchip=on"
|
||||
|
||||
splitIrqChipMachineOptions = "accel=kvm,kernel_irqchip=split"
|
||||
|
||||
qmpMigrationWaitTimeout = 5 * time.Second
|
||||
)
|
||||
|
||||
var qemuPaths = map[string]string{
|
||||
QemuQ35: defaultQemuPath,
|
||||
QemuMicrovm: defaultQemuPath,
|
||||
}
|
||||
|
||||
var kernelParams = []Param{
|
||||
{"tsc", "reliable"},
|
||||
{"no_timer_check", ""},
|
||||
@@ -101,7 +98,7 @@ func newQemuArch(config HypervisorConfig) (qemuArch, error) {
|
||||
// IOMMU and Guest Protection require a split IRQ controller for handling interrupts
|
||||
// otherwise QEMU won't be able to create the kernel irqchip
|
||||
if config.IOMMU || config.ConfidentialGuest {
|
||||
mp.Options = "accel=kvm,kernel_irqchip=split"
|
||||
mp.Options = splitIrqChipMachineOptions
|
||||
}
|
||||
|
||||
if config.IOMMU {
|
||||
@@ -114,7 +111,7 @@ func newQemuArch(config HypervisorConfig) (qemuArch, error) {
|
||||
q := &qemuAmd64{
|
||||
qemuArchBase: qemuArchBase{
|
||||
qemuMachine: *mp,
|
||||
qemuExePath: qemuPaths[machineType],
|
||||
qemuExePath: defaultQemuPath,
|
||||
memoryOffset: config.MemOffset,
|
||||
kernelParamsNonDebug: kernelParamsNonDebug,
|
||||
kernelParamsDebug: kernelParamsDebug,
|
||||
@@ -172,19 +169,6 @@ func (q *qemuAmd64) bridges(number uint32) {
|
||||
q.Bridges = genericBridges(number, q.qemuMachine.Type)
|
||||
}
|
||||
|
||||
func (q *qemuAmd64) cpuModel() string {
|
||||
cpuModel := defaultCPUModel
|
||||
|
||||
// VMX is not migratable yet.
|
||||
// issue: https://github.com/kata-containers/runtime/issues/1750
|
||||
if q.vmFactory {
|
||||
hvLogger.WithField("subsystem", "qemuAmd64").Warn("VMX is not migratable yet: turning it off")
|
||||
cpuModel += ",vmx=off"
|
||||
}
|
||||
|
||||
return cpuModel
|
||||
}
|
||||
|
||||
func (q *qemuAmd64) memoryTopology(memoryMb, hostMemoryMb uint64, slots uint8) govmmQemu.Memory {
|
||||
return genericMemoryTopology(memoryMb, hostMemoryMb, slots, q.memoryOffset)
|
||||
}
|
||||
|
@@ -87,7 +87,7 @@ func TestQemuAmd64CPUModel(t *testing.T) {
|
||||
base, ok := amd64.(*qemuAmd64)
|
||||
assert.True(ok)
|
||||
base.vmFactory = true
|
||||
expectedOut = defaultCPUModel + ",vmx=off"
|
||||
expectedOut = defaultCPUModel
|
||||
model = amd64.cpuModel()
|
||||
assert.Equal(expectedOut, model)
|
||||
}
|
||||
|
@@ -114,10 +114,6 @@ func (q *qemuPPC64le) bridges(number uint32) {
|
||||
q.Bridges = genericBridges(number, q.qemuMachine.Type)
|
||||
}
|
||||
|
||||
func (q *qemuPPC64le) cpuModel() string {
|
||||
return defaultCPUModel
|
||||
}
|
||||
|
||||
func (q *qemuPPC64le) memoryTopology(memoryMb, hostMemoryMb uint64, slots uint8) govmmQemu.Memory {
|
||||
|
||||
q.Logger().Debug("Aligning maxmem to multiples of 256MB. Assumption: Kernel Version >= 4.11")
|
||||
|
Reference in New Issue
Block a user