Skip to content

Commit

Permalink
Skip querying preference if OS is empty
Browse files Browse the repository at this point in the history
We may have VM without OS set. In such case we get an empty string from
the map. This patch will prevent querying and erroring when we hit this
case.

Signed-off-by: Liran Rotenberg <[email protected]>
  • Loading branch information
liranr23 authored and ahadas committed Apr 18, 2024
1 parent 38dae0b commit d0712b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/controller/plan/kubevirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,10 @@ func (r *KubeVirt) vmPreference(vm *plan.VMStatus) (virtualMachine *cnv.VirtualM
if err != nil {
return
}
if preferenceName == "" {
err = liberr.New("couldn't find a corresponding preference", "vm", vm)
return
}

preferenceName, kind, err := r.getPreference(vm, preferenceName)
if err != nil {
Expand Down

0 comments on commit d0712b3

Please sign in to comment.