Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cpu_pinning and isolate_emulator_thread option #63

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions harvester/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions harvester/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
}
}

Expand Down Expand Up @@ -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()
}

Expand Down
3 changes: 3 additions & 0 deletions harvester/harvester.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ type Driver struct {
EnableEFI bool
EnableSecureBoot bool
VGPUInfo *VGPUInfo

CPUPinning bool
IsolateEmulatorThread bool
}

func NewDriver(hostName, storePath string) *Driver {
Expand Down
Loading