diff --git a/harvester/create.go b/harvester/create.go index da67ce4..3eea7ab 100644 --- a/harvester/create.go +++ b/harvester/create.go @@ -106,6 +106,10 @@ func (d *Driver) Create() error { vm.Spec.Template.Spec.Domain.Features.SMM = &kubevirtv1.FeatureState{Enabled: &v} vm.Spec.Template.Spec.Domain.Firmware = &kubevirtv1.Firmware{Bootloader: &kubevirtv1.Bootloader{EFI: &kubevirtv1.EFI{SecureBoot: &v}}} } + + vm.Spec.Template.Spec.Domain.CPU.DedicatedCPUPlacement = d.CPUPinning + vm.Spec.Template.Spec.Domain.CPU.IsolateEmulatorThread = d.IsolateEmulatorThread + createdVM, err := d.createVM(vm) if err != nil { return err diff --git a/harvester/flags.go b/harvester/flags.go index e9ae04f..5045bc1 100644 --- a/harvester/flags.go +++ b/harvester/flags.go @@ -158,6 +158,16 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag { Name: "harvester-vgpu-info", Usage: "harvester-vgpu-info", }, + mcnflag.BoolFlag{ + EnvVar: "HARVESTER_CPU_PINNING", + Name: "harvester-cpu-pinning", + Usage: "enable vm cpu pinning, please ensure the harvester cluster has cpu manager enabled in at least one node", + }, + mcnflag.BoolFlag{ + EnvVar: "HARVESTER_ISOLATE_EMULATOR_THREAD", + Name: "harvester-isolate-emulator-thread", + Usage: "enable vm isolatated emulator thread", + }, } } @@ -250,6 +260,10 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error { } d.VGPUInfo = vGPUInfo } + + d.CPUPinning = flags.Bool("harvester-cpu-pinning") + d.IsolateEmulatorThread = flags.Bool("harvester-isolate-emulator-thread") + return d.checkConfig() } diff --git a/harvester/harvester.go b/harvester/harvester.go index d72e3fa..94c742e 100644 --- a/harvester/harvester.go +++ b/harvester/harvester.go @@ -73,6 +73,9 @@ type Driver struct { EnableEFI bool EnableSecureBoot bool VGPUInfo *VGPUInfo + + CPUPinning bool + IsolateEmulatorThread bool } func NewDriver(hostName, storePath string) *Driver {