-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The validation will now check if the VM is set with custom CPU model and show it to the user. Signed-off-by: Liran Rotenberg <[email protected]>
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
validation/policies/io/konveyor/forklift/ovirt/cpu_custom_model.rego
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,16 @@ | ||
package io.konveyor.forklift.ovirt | ||
|
||
default custom_cpu_model = false | ||
|
||
custom_cpu_model = true { | ||
count(input.customCpuModel) != 0 | ||
} | ||
|
||
concerns[flag] { | ||
custom_cpu_model | ||
flag := { | ||
"category": "Warning", | ||
"label": "Custom CPU Model detected", | ||
"assessment": "The VM is configured with a custom CPU model. This configuration will apply to the migrated VM and may not be supported by OpenShift Virtualization." | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
validation/policies/io/konveyor/forklift/ovirt/cpu_custom_model_test.rego
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,15 @@ | ||
package io.konveyor.forklift.ovirt | ||
|
||
test_without_customcpu { | ||
mock_vm := { "name": "test" } | ||
results = concerns with input as mock_vm | ||
count(results) == 0 | ||
} | ||
|
||
test_with_customcpu { | ||
mock_vm := { "name": "test", | ||
"customCpuModel": "Icelake-Server-noTSX,-mpx" | ||
} | ||
results = concerns with input as mock_vm | ||
count(results) == 1 | ||
} |