File tree Expand file tree Collapse file tree
images/virtualization-artifact/pkg/controller/kvbuilder Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,9 +166,8 @@ func (b *KVVM) SetCPUModel(class *v1alpha2.VirtualMachineClass) error {
166166 cpu .Features = []virtv1.CPUFeature {{Name : HTCPUFeature , Policy : "require" }}
167167 case v1alpha2 .CPUTypeDiscovery , v1alpha2 .CPUTypeFeatures :
168168 cpu .Model = GenericCPUModel
169- features := make ([]virtv1.CPUFeature , 0 , len (class .Status .CpuFeatures .Enabled )+ 2 )
169+ features := make ([]virtv1.CPUFeature , 0 , len (class .Status .CpuFeatures .Enabled )+ 1 )
170170 hasSvm := false
171- hasHT := false
172171 for _ , feature := range class .Status .CpuFeatures .Enabled {
173172 policy := "require"
174173 if feature == "invtsc" {
@@ -177,9 +176,6 @@ func (b *KVVM) SetCPUModel(class *v1alpha2.VirtualMachineClass) error {
177176 if feature == "svm" {
178177 hasSvm = true
179178 }
180- if feature == HTCPUFeature {
181- hasHT = true
182- }
183179 features = append (features , virtv1.CPUFeature {
184180 Name : feature ,
185181 Policy : policy ,
@@ -188,9 +184,6 @@ func (b *KVVM) SetCPUModel(class *v1alpha2.VirtualMachineClass) error {
188184 if ! hasSvm {
189185 features = append (features , virtv1.CPUFeature {Name : "svm" , Policy : "optional" })
190186 }
191- if ! hasHT {
192- features = append (features , virtv1.CPUFeature {Name : HTCPUFeature , Policy : "require" })
193- }
194187 cpu .Features = features
195188 default :
196189 return fmt .Errorf ("unexpected cpu type: %q" , class .Spec .CPU .Type )
Original file line number Diff line number Diff line change @@ -247,26 +247,6 @@ func TestSetCPUModel(t *testing.T) {
247247 }
248248 })
249249
250- t .Run ("should add required ht feature for discovery cpu" , func (t * testing.T ) {
251- builder := NewEmptyKVVM (types.NamespacedName {Name : name , Namespace : namespace }, KVVMOptions {})
252- class := & v1alpha2.VirtualMachineClass {
253- Spec : v1alpha2.VirtualMachineClassSpec {
254- CPU : v1alpha2.CPU {Type : v1alpha2 .CPUTypeDiscovery },
255- },
256- Status : v1alpha2.VirtualMachineClassStatus {
257- CpuFeatures : v1alpha2.CpuFeatures {Enabled : []string {"aes" }},
258- },
259- }
260-
261- if err := builder .SetCPUModel (class ); err != nil {
262- t .Fatalf ("SetCPUModel() failed: %v" , err )
263- }
264-
265- features := builder .Resource .Spec .Template .Spec .Domain .CPU .Features
266- if ! containsCPUFeature (features , virtv1.CPUFeature {Name : HTCPUFeature , Policy : "require" }) {
267- t .Fatalf ("expected required ht feature to be added, got %#v" , features )
268- }
269- })
270250
271251 t .Run ("should keep existing ht feature policy when already present" , func (t * testing.T ) {
272252 builder := NewEmptyKVVM (types.NamespacedName {Name : name , Namespace : namespace }, KVVMOptions {})
You can’t perform that action at this time.
0 commit comments