Bug 1753243 - [SSP] Common templates validations - wrong value of minimal-required-memory
Summary: [SSP] Common templates validations - wrong value of minimal-required-memory
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: Guest Support
Version: 2.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
: 2.3.0
Assignee: Karel Šimon
QA Contact: Ruth Netser
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-09-18 13:17 UTC by Ruth Netser
Modified: 2020-05-04 19:10 UTC (History)
5 users (show)

Fixed In Version: common-templates-0.8.0 kubevirt-ssp-operator:v2.2.0-2
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-04 19:10:36 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2020:2011 0 None None None 2020-05-04 19:10:47 UTC

Internal Links: 1753252

Description Ruth Netser 2019-09-18 13:17:56 UTC
Description of problem:
The value of minimal-required-memory in common templates is taken from libosinfo.
Currently the value is taken from ppc section (https://gitlab.com/libosinfo/osinfo-db/blob/master/data/os/redhat.com/rhel-8.0.xml.in#L121) and not from generic architecture section (https://gitlab.com/libosinfo/osinfo-db/blob/master/data/os/redhat.com/rhel-8.0.xml.in#L136)

This is because https://github.com/kubevirt/common-templates/blob/master/templates/_linux.yaml#L29 directs to ".0" which selects ppc (the first section)

Version-Release number of selected component (if applicable):
CNV 2.1.0, OCP 4.2.0

How reproducible:
100%

Steps to Reproduce:
1. Find Os system information for an OS template in https://gitlab.com/libosinfo/osinfo-db/blob/master/data/os

For example, for RHEL8 - https://gitlab.com/libosinfo/osinfo-db/blob/master/data/os/redhat.com/rhel-8.0.xml.in

2. Check the minimum required RAM, under <resources arch="all"><minimum><ram>

For example, for RHEL8 - https://gitlab.com/libosinfo/osinfo-db/blob/master/data/os/redhat.com/rhel-8.0.xml.in#L136

3. In the template, check the value of minimum memory in the validation section

For example:
oc get templates -n openshift rhel8-server-tiny-v0.6.2 -o yaml
validations --> "name": "minimal-required-memory"


Actual results:
The value (2G) is taken from the first architecture section, which is ppc and not from the generic section (1G) which comes after.


Expected results:
The value should be taken from the generic (<resources arch="all">) section.

Additional info:

====== libosinfo for RHEL8 ======
    <resources arch="ppc64le">
      <minimum>
        <n-cpus>1</n-cpus>
        <cpu>1000000000</cpu>
        <ram>2147483648</ram>
        <storage>10737418240</storage>
      </minimum>

      <recommended>
        <cpu>4000000000</cpu>
        <ram>2147483648</ram>
        <storage>21474836480</storage>
      </recommended>
    </resources>

    <resources arch="all">
      <minimum>
        <n-cpus>1</n-cpus>
        <cpu>1000000000</cpu>
        <ram>1073741824</ram>
        <storage>10737418240</storage>
      </minimum>

      <recommended>
        <cpu>1000000000</cpu>
        <ram>1073741824</ram>
        <storage>10737418240</storage>
      </recommended>

============================================================================

====== oc get templates -n openshift rhel8-server-tiny-v0.6.2 -o yaml ======
    validations: |
      [
        {
          "name": "minimal-required-memory",
          "path": "jsonpath::.spec.domain.resources.requests.memory",
          "rule": "integer",
          "message": "This VM requires more memory.",
          "min": 2147483648
        },
      ]
============================================================================

Comment 1 Martin Sivák 2019-11-11 08:37:19 UTC
This is fixed in common-templates-0.8.0 upstream. Downstream will get it on the next d/s rebuild of SSP operator for 2.2.

Comment 2 Ruth Netser 2019-12-19 10:53:18 UTC
Re-opening.
Wrong minimum value for RHEL8.

Template: "min": 1073741824
oslibinfo: 1610612736



=========================================== RHEL 8 template ===============================================

$ oc get template -n openshift -oyaml rhel8-server-large-v0.7.0 
apiVersion: template.openshift.io/v1
kind: Template
metadata:
  annotations:
    defaults.template.kubevirt.io/disk: rootdisk
    description: This template can be used to create a VM suitable for Red Hat Enterprise
      Linux 7 and newer. The template assumes that a PVC is available which is providing
      the necessary RHEL disk image.
    iconClass: icon-rhel
    name.os.template.kubevirt.io/rhel8.0: Red Hat Enterprise Linux 8.0
    name.os.template.kubevirt.io/rhel8.1: Red Hat Enterprise Linux 8.1
    openshift.io/display-name: Red Hat Enterprise Linux 7.0+ VM
    openshift.io/documentation-url: https://github.com/kubevirt/common-templates
    openshift.io/provider-display-name: KubeVirt
    openshift.io/support-url: https://github.com/kubevirt/common-templates/issues
    tags: kubevirt,virtualmachine,linux,rhel
    template.kubevirt.io/editable: |
      /objects[0].spec.template.spec.domain.cpu.sockets
      /objects[0].spec.template.spec.domain.cpu.cores
      /objects[0].spec.template.spec.domain.cpu.threads
      /objects[0].spec.template.spec.domain.resources.requests.memory
      /objects[0].spec.template.spec.domain.devices.disks
      /objects[0].spec.template.spec.volumes
      /objects[0].spec.template.spec.networks
    template.kubevirt.io/version: v1alpha1
    template.openshift.io/bindable: "false"
    validations: |
      [
        {
          "name": "minimal-required-memory",
          "path": "jsonpath::.spec.domain.resources.requests.memory",
          "rule": "integer",
          "message": "This VM requires more memory.",
          "min": 1073741824
        }
      ]
  creationTimestamp: "2019-12-18T05:54:11Z"
  labels:
    flavor.template.kubevirt.io/large: "true"
    os.template.kubevirt.io/rhel8.0: "true"
    os.template.kubevirt.io/rhel8.1: "true"
    template.kubevirt.io/type: base
    template.kubevirt.io/version: v0.8.1
    workload.template.kubevirt.io/server: "true"
  name: rhel8-server-large-v0.7.0
  namespace: openshift
  ownerReferences:
  - apiVersion: kubevirt.io/v1
    kind: KubevirtCommonTemplatesBundle
    name: common-templates-hyperconverged-cluster
    uid: 19aaacad-4afe-48a3-b260-30e8bb7b767f
  resourceVersion: "697955"
  selfLink: /apis/template.openshift.io/v1/namespaces/openshift/templates/rhel8-server-large-v0.7.0
  uid: fe2e81a4-4f92-4f63-8378-d8664e5945d9
objects:
- apiVersion: kubevirt.io/v1alpha3
  kind: VirtualMachine
  metadata:
    labels:
      app: ${NAME}
      vm.kubevirt.io/template: rhel8-server-large
      vm.kubevirt.io/template.revision: "1"
      vm.kubevirt.io/template.version: v0.8.1
    name: ${NAME}
  spec:
    running: false
    template:
      metadata:
        labels:
          kubevirt.io/domain: ${NAME}
          kubevirt.io/size: large
      spec:
        domain:
          cpu:
            cores: 1
            sockets: 2
            threads: 1
          devices:
            disks:
            - disk:
                bus: virtio
              name: rootdisk
            - disk:
                bus: virtio
              name: cloudinitdisk
            interfaces:
            - masquerade: {}
              name: default
            networkInterfaceMultiqueue: true
            rng: {}
          resources:
            requests:
              memory: 8G
        evictionStrategy: LiveMigrate
        networks:
        - name: default
          pod: {}
        terminationGracePeriodSeconds: 0
        volumes:
        - name: rootdisk
          persistentVolumeClaim:
            claimName: ${PVCNAME}
        - cloudInitNoCloud:
            userData: |-
              #cloud-config
              password: redhat
              chpasswd: { expire: False }
          name: cloudinitdisk
parameters:
- description: VM name
  from: rhel8-[a-z0-9]{16}
  generate: expression
  name: NAME
- description: Name of the PVC with the disk image
  name: PVCNAME
  required: true

================================= oslibinfo  https://gitlab.com/libosinfo/osinfo-db/blob/master/data/os/redhat.com/rhel-8.0.xml.in#L128 =========================================================
    <resources arch="all">
      <minimum>
        <n-cpus>1</n-cpus>
        <cpu>1000000000</cpu>
        <ram>1610612736</ram>
        <storage>10737418240</storage>
      </minimum>


==========================================================================================

Comment 3 Ruth Netser 2019-12-19 10:53:39 UTC
Re-opened on
$ oc get csv -n openshift-cnv
NAME                                      DISPLAY                                    VERSION   REPLACES                                  PHASE
kubevirt-hyperconverged-operator.v2.2.0   Container-native virtualization Operator   2.2.0     kubevirt-hyperconverged-operator.v2.1.0   Succeeded

Comment 4 Martin Sivák 2019-12-19 11:40:06 UTC
This just needs a rebuild and new release of templates. libosinfo was updated - https://gitlab.com/libosinfo/osinfo-db/commit/00a2aea54251e33bc20ed7fb5d0fab43e528b178

Comment 11 Ruth Netser 2020-02-23 08:44:46 UTC
Closing, verified on kubevirt-hyperconverged-operator.v2.3.0


$ oc get template -n openshift -oyaml rhel8-server-large-v0.7.0 
apiVersion: template.openshift.io/v1
kind: Template
metadata:
  annotations:
    defaults.template.kubevirt.io/disk: rootdisk
    description: This template can be used to create a VM suitable for Red Hat Enterprise
      Linux 7 and newer. The template assumes that a PVC is available which is providing
      the necessary RHEL disk image.
    iconClass: icon-rhel
    name.os.template.kubevirt.io/rhel8.0: Red Hat Enterprise Linux 8.0
    name.os.template.kubevirt.io/rhel8.1: Red Hat Enterprise Linux 8.1
    openshift.io/display-name: Red Hat Enterprise Linux 7.0+ VM
    openshift.io/documentation-url: https://github.com/kubevirt/common-templates
    openshift.io/provider-display-name: KubeVirt
    openshift.io/support-url: https://github.com/kubevirt/common-templates/issues
    tags: kubevirt,virtualmachine,linux,rhel
    template.kubevirt.io/editable: |
      /objects[0].spec.template.spec.domain.cpu.sockets
      /objects[0].spec.template.spec.domain.cpu.cores
      /objects[0].spec.template.spec.domain.cpu.threads
      /objects[0].spec.template.spec.domain.resources.requests.memory
      /objects[0].spec.template.spec.domain.devices.disks
      /objects[0].spec.template.spec.volumes
      /objects[0].spec.template.spec.networks
    template.kubevirt.io/version: v1alpha1
    template.openshift.io/bindable: "false"
    validations: |
      [
        {
          "name": "minimal-required-memory",
          "path": "jsonpath::.spec.domain.resources.requests.memory",
          "rule": "integer",
          "message": "This VM requires more memory.",
          "min": 1610612736
        }
      ]

Comment 14 errata-xmlrpc 2020-05-04 19:10:36 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, 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/RHEA-2020:2011


Note You need to log in before you can comment on or make changes to this bug.