You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@jellonek
I see that the #696 has supported to set cpu model to "host-model". I don't know the #696 has implemented it before:)
I also implemented a new version based v1.0.0, it can set more cpu features, and set host-model,pass-through,custum etc.
I think the new version is more flexible.
Please take a look if we need the new version. thanks.
some code
func (va *VirtletAnnotations) parsePodAnnotations(ns string, podAnnotations map[string]string) error {
+ if cpuModeStr, found := podAnnotations[cpuMode]; found {
+ var cpuMode libvirtxml.DomainCPU
+ if err := yaml.Unmarshal([]byte(cpuModeStr), &cpuMode); err != nil {
+ return err
+ }
+ va.CPUMode = &cpuMode
+ }
+
if podAnnotations[cloudInitUserDataOverwriteKeyName] == "true" {
va.UserDataOverwrite = true
}
@@ -106,18 +106,19 @@ func (ds *domainSettings) createDomain(config *VMConfig) *libvirtxml.Domain {
// The plan is to enable it via an annotation at some point.
// It commonly requires kvm_intel module to be loaded like this:
// modprobe kvm_intel nested=1
- CPU: &libvirtxml.DomainCPU{
- Mode: "host-model",
- Model: &libvirtxml.DomainCPUModel{
- Fallback: "forbid",
- },
- Features: []libvirtxml.DomainCPUFeature{
- {
- Policy: "require",
- Name: "avx",
- },
- },
- },
+ CPU: config.ParsedAnnotations.CPUMode,
for pod spec:
apiVersion: v1
kind: Pod
metadata:
name: cirros-vm
annotations:
# This tells CRI Proxy that this pod belongs to Virtlet runtime
kubernetes.io/target-runtime: virtlet.cloud
# CirrOS doesn't load nocloud data from SCSI CD-ROM for some reason
VirtletDiskDriver: virtio
VirtletVCPUCount: "4"
# for "mode": host-model, host-passthrough,custom
# for "model": Westmere, SandyBridge
VirtletCPUMode: |
mode: custom
model:
value: Westmere
features:
- name: avx
policy: disable
The text was updated successfully, but these errors were encountered:
Can you propose a PR which in same time will retain the simplicity of usage provided in #696 with a flexibility of suggestion provided there?
After changes in #696 you can set single string valued annotation without knowing internals of libvirt, to enable nested virtualization. It can be also provided globally for all vm pods, or for vm pods per node - using virtlet configuration.
Having a possibility to pass more details for cpu settings (maybe by having in parallel VirtletCPUMode with a new VirtletCPUSettings based on this proposal?) would be imo very interesting.
@jellonek
I see that the #696 has supported to set cpu model to "host-model". I don't know the #696 has implemented it before:)
I also implemented a new version based v1.0.0, it can set more cpu features, and set host-model,pass-through,custum etc.
I think the new version is more flexible.
Please take a look if we need the new version. thanks.
some code
for pod spec:
The text was updated successfully, but these errors were encountered: