-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vm): use generic model with explicit features for Discovery cpu type
- Use kvm64 model for Discovery and Features types. - Patch kubevirt to prevent node selector on VM Pos for kvm64 model. - Add internal documentation describing problems with Discovery type. Signed-off-by: Ivan Mikheykin <[email protected]>
- Loading branch information
Showing
5 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# CPUModel type Discovery | ||
|
||
## Problem | ||
|
||
The first approach was to use host-model with a common set of features. This was a mistake, as | ||
libvirt resolves the host-model to the specific host CPU model, which can be different on different nodes | ||
and migration not works. | ||
|
||
The second approach was to use "Empty" model in cpu-map directory. It works partially for some CPU combinations. | ||
Other combinations lead to migration problems. These combinations are unpredictable, so no workaround. | ||
The error might be a bug in libvirt when it compares features after resolving the target CPU model (still | ||
need to investigate). | ||
|
||
The current approach is to use kvm64 model for Discovery and Features types. This model contains a small | ||
set of features and migration works well. | ||
|
||
## Solution | ||
|
||
1. Use kvm64 model for Discovery and Features vmclass types. | ||
2. Add patch for kubevirt to prevent adding nodeSelector for cpu model "kvm64". |
44 changes: 44 additions & 0 deletions
44
...es/virt-artifact/patches/031-prevent-adding-node-selector-for-dvp-generic-cpu-model.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
diff --git a/pkg/virt-controller/services/nodeselectorrenderer.go b/pkg/virt-controller/services/nodeselectorrenderer.go | ||
index 390f359d2a..c21caf97dd 100644 | ||
--- a/pkg/virt-controller/services/nodeselectorrenderer.go | ||
+++ b/pkg/virt-controller/services/nodeselectorrenderer.go | ||
@@ -23,6 +23,9 @@ type NodeSelectorRenderer struct { | ||
|
||
type NodeSelectorRendererOption func(renderer *NodeSelectorRenderer) | ||
|
||
+// DeckhouseVirtualizationPlatformGenericCPUModel is a name of additional empty CPU model for Discovery type of VMClass. | ||
+const DeckhouseVirtualizationPlatformGenericCPUModel = "kvm64" | ||
+ | ||
func NewNodeSelectorRenderer( | ||
vmiNodeSelectors map[string]string, | ||
clusterWideConfNodeSelectors map[string]string, | ||
@@ -51,7 +54,8 @@ func (nsr *NodeSelectorRenderer) Render() map[string]string { | ||
if nsr.hyperv { | ||
maps.Copy(nsr.podNodeSelectors, hypervNodeSelectors(nsr.vmiFeatures)) | ||
} | ||
- if nsr.cpuModelLabel != "" && nsr.cpuModelLabel != cpuModelLabel(v1.CPUModeHostModel) && nsr.cpuModelLabel != cpuModelLabel(v1.CPUModeHostPassthrough) { | ||
+ // Prevent adding node selector for host-model, host-passthrough and an empty CPU model. | ||
+ if nsr.cpuModelLabel != "" && nsr.cpuModelLabel != cpuModelLabel(v1.CPUModeHostModel) && nsr.cpuModelLabel != cpuModelLabel(v1.CPUModeHostPassthrough) && nsr.cpuModelLabel != cpuModelLabel(DeckhouseVirtualizationPlatformGenericCPUModel) { | ||
nsr.enableSelectorLabel(nsr.cpuModelLabel) | ||
} | ||
for _, cpuFeatureLabel := range nsr.cpuFeatureLabels { | ||
diff --git a/pkg/virt-launcher/virtwrap/live-migration-source.go b/pkg/virt-launcher/virtwrap/live-migration-source.go | ||
index 5cc14a1f85..6bd0ba3d9d 100644 | ||
--- a/pkg/virt-launcher/virtwrap/live-migration-source.go | ||
+++ b/pkg/virt-launcher/virtwrap/live-migration-source.go | ||
@@ -230,6 +230,15 @@ func migratableDomXML(dom cli.VirDomain, vmi *v1.VirtualMachineInstance, domSpec | ||
return "", err | ||
} | ||
|
||
+ // Put back common model if specified in VMI. | ||
+ vmiCPU := vmi.Spec.Domain.CPU | ||
+ if vmiCPU != nil && vmiCPU.Model == "kvm64" { | ||
+ if domcfg.CPU.Model != nil { | ||
+ domcfg.CPU.Model.Value = vmiCPU.Model | ||
+ domcfg.CPU.Model.Fallback = "allow" | ||
+ } | ||
+ } | ||
+ | ||
return domcfg.Marshal() | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters