Bug 2236545

Summary: Template validator is broken for spec.domain.memory.guest value
Product: Container Native Virtualization (CNV) Reporter: vsibirsk
Component: SSPAssignee: Karel Šimon <ksimon>
Status: CLOSED ERRATA QA Contact: Kedar Bidarkar <kbidarka>
Severity: high Docs Contact:
Priority: high    
Version: 4.14.0CC: dholler, dshchedr
Target Milestone: ---   
Target Release: 4.14.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kubevirt-ssp-operator-rhel9-container-v4.14.0-106 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-08 14:06:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description vsibirsk 2023-08-31 17:07:50 UTC
Description of problem:
Template validator fails on spec.domain.memory.guest values

Version-Release number of selected component (if applicable):
common templates version v0.26

How reproducible:
100%

Steps to Reproduce:
1.Try to create a VM from any common template of ver 0.26
2.
3.

Actual results:
fails to create a VM
validator show error
Error "This VM requires more memory.: mismatching type: , not int or resource.Quantity" for field ".spec.domain.memory.guest".

Expected results:
VM created successfully

Additional info:
Seems like like current template validator can't parse G,Gi,M,Mi,etc strings into integers (like with spec.domain.resources.requests.memory)

Gives error when setting memory.guest to 1.5Gi
vm.kubevirt.io/validations: |
      [
        {
          "name": "minimal-required-memory",
          "path": "jsonpath::.spec.domain.memory.guest",
          "rule": "integer",
          "message": "This VM requires more memory.",
          "min": 1610612736
        }

Validates resources.requests.memory value of 1.5Gi
vm.kubevirt.io/validations: |
      [
        {
          "name": "minimal-required-memory",
          "path": "jsonpath::.spec.domain.resources.requests.memory",
          "rule": "integer",
          "message": "This VM requires more memory.",
          "min": 1610612736
        }
      ]
      ]

Comment 1 vsibirsk 2023-09-11 14:02:00 UTC
Verified with ssp-operator v4.14.0-107

Created RHEL 9 VM from common template.
Validator accepted 1.5G memory.guest value and VM was created successfully.

Comment 3 errata-xmlrpc 2023-11-08 14:06:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Virtualization 4.14.0 Images security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:6817