Bug 1899460

Summary: [SSP] After upgrade from 2.4, it is not possible to attach PVCs to Windows golden images
Product: Container Native Virtualization (CNV) Reporter: Ruth Netser <rnetser>
Component: SSPAssignee: Omer Yahud <oyahud>
Status: CLOSED ERRATA QA Contact: Israel Pinto <ipinto>
Severity: high Docs Contact:
Priority: unspecified    
Version: 2.5.1CC: cnv-qe-bugs, fdeutsch, ksimon
Target Milestone: ---   
Target Release: 2.5.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kubevirt-ssp-operator-container-v2.5.2-3 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-12-16 00:16:58 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:
Attachments:
Description Flags
Acreenshot after upgrade none

Description Ruth Netser 2020-11-19 10:05:51 UTC
Description of problem:
After upgrade from 2.4 to 2.5, there are 2 sets of Windows templates (bug 1886453). Both templates have the same version.
When trying to attach a PVC to an OS (i.e create a golden image), as the selected templates do not have the required golden images parameters, it is not possible to attach a PVC to any Windows OS.


Version-Release number of selected component (if applicable):
OCP 3.6, CNV 2.5.1

How reproducible:
100%

Steps to Reproduce:
1. Upgrade from CNV-2.4 to CNV-2.5
2. In the UI, try to attach a PVC to OS


Actual results:
It is not possible to attach a PVC to Windows OS.

Expected results:
The new templates should be the only ones available for selection, thus enabling to select the OS.

Additional info:

$ oc get template -n openshift win2k12r2-desktop-medium-v0.11.3 -oyaml
apiVersion: template.openshift.io/v1
kind: Template
metadata:
  annotations:
    defaults.template.kubevirt.io/disk: rootdisk
    defaults.template.kubevirt.io/network: default
    description: Template for Microsoft Windows Server 2012 R2 VM. A PVC with the Windows disk image must be available.
    iconClass: icon-windows
    name.os.template.kubevirt.io/win2k12r2: Microsoft Windows Server 2012 R2
    name.os.template.kubevirt.io/win2k16: Microsoft Windows Server 2016
    name.os.template.kubevirt.io/win2k19: Microsoft Windows Server 2019
    name.os.template.kubevirt.io/win10: Microsoft Windows 10
    openshift.io/display-name: Microsoft Windows Server 2012 R2 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: hidden,kubevirt,virtualmachine,windows
    template.kubevirt.io/deprecated: "true"
    template.kubevirt.io/editable: |
      /objects[0].spec.template.spec.domain.cpu.cores
      /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": 536870912
        }, {
          "name": "windows-virtio-bus",
          "path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
          "valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
          "rule": "enum",
          "message": "virto disk bus type has better performance, install virtio drivers in VM and change bus type",
          "values": ["virtio"],
          "justWarning": true
        }, {
          "name": "windows-disk-bus",
          "path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
          "valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
          "rule": "enum",
          "message": "disk bus has to be either virtio or sata",
          "values": ["virtio", "sata"]
        }, {
          "name": "windows-cd-bus",
          "path": "jsonpath::.spec.domain.devices.disks[*].cdrom.bus",
          "valid": "jsonpath::.spec.domain.devices.disks[*].cdrom.bus",
          "rule": "enum",
          "message": "cd bus has to be sata",
          "values": ["sata"]
        }
      ]
  creationTimestamp: "2020-11-16T12:25:32Z"
  labels:
    flavor.template.kubevirt.io/medium: "true"
    os.template.kubevirt.io/win2k12r2: "true"
    os.template.kubevirt.io/win2k16: "true"
    os.template.kubevirt.io/win2k19: "true"
    os.template.kubevirt.io/win10: "true"
    template.kubevirt.io/type: base
    template.kubevirt.io/version: v0.12.3
    workload.template.kubevirt.io/desktop: "true"


$ oc get template -n openshift windows2k12r2-server-medium-v0.12.3 -oyaml
apiVersion: template.openshift.io/v1
kind: Template
metadata:
  annotations:
    defaults.template.kubevirt.io/disk: rootdisk
    defaults.template.kubevirt.io/network: default
    description: Template for Microsoft Windows Server 2012 R2 VM. A PVC with the Windows disk image must be available.
    iconClass: icon-windows
    name.os.template.kubevirt.io/win2k12r2: Microsoft Windows Server 2012 R2
    openshift.io/display-name: Microsoft Windows Server 2012 R2 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: hidden,kubevirt,virtualmachine,windows
    template.kubevirt.io/editable: |
      /objects[0].spec.template.spec.domain.cpu.cores
      /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": 536870912
        }, {
          "name": "windows-virtio-bus",
          "path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
          "valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
          "rule": "enum",
          "message": "virto disk bus type has better performance, install virtio drivers in VM and change bus type",
          "values": ["virtio"],
          "justWarning": true
        }, {
          "name": "windows-disk-bus",
          "path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
          "valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
          "rule": "enum",
          "message": "disk bus has to be either virtio or sata",
          "values": ["virtio", "sata"]
        }, {
          "name": "windows-cd-bus",
          "path": "jsonpath::.spec.domain.devices.disks[*].cdrom.bus",
          "valid": "jsonpath::.spec.domain.devices.disks[*].cdrom.bus",
          "rule": "enum",
          "message": "cd bus has to be sata",
          "values": ["sata"]
        }
      ]
  creationTimestamp: "2020-11-16T15:18:02Z"
  labels:
    flavor.template.kubevirt.io/medium: "true"
    os.template.kubevirt.io/win2k12r2: "true"
    template.kubevirt.io/type: base
    template.kubevirt.io/version: v0.12.3
    workload.template.kubevirt.io/server: "true"


$ oc get template -n openshift windows10-desktop-medium-v0.11.3 -oyaml
apiVersion: template.openshift.io/v1
kind: Template
metadata:
  annotations:
    defaults.template.kubevirt.io/disk: rootdisk
    defaults.template.kubevirt.io/network: default
    description: Template for Microsoft Windows 10 VM. A PVC with the Windows disk image must be available.
    iconClass: icon-windows
    name.os.template.kubevirt.io/win10: Microsoft Windows 10
    openshift.io/display-name: Microsoft Windows 10 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: hidden,kubevirt,virtualmachine,windows
    template.kubevirt.io/editable: |
      /objects[0].spec.template.spec.domain.cpu.cores
      /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": 2147483648
        }, {
          "name": "windows-virtio-bus",
          "path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
          "valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
          "rule": "enum",
          "message": "virto disk bus type has better performance, install virtio drivers in VM and change bus type",
          "values": ["virtio"],
          "justWarning": true
        }, {
          "name": "windows-disk-bus",
          "path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
          "valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
          "rule": "enum",
          "message": "disk bus has to be either virtio or sata",
          "values": ["virtio", "sata"]
        }, {
          "name": "windows-cd-bus",
          "path": "jsonpath::.spec.domain.devices.disks[*].cdrom.bus",
          "valid": "jsonpath::.spec.domain.devices.disks[*].cdrom.bus",
          "rule": "enum",
          "message": "cd bus has to be sata",
          "values": ["sata"]
        }
      ]
  creationTimestamp: "2020-11-16T12:25:35Z"
  labels:
    flavor.template.kubevirt.io/medium: "true"
    os.template.kubevirt.io/win10: "true"
    template.kubevirt.io/type: base
    template.kubevirt.io/version: v0.12.3
    workload.template.kubevirt.io/desktop: "true"

Comment 2 Omer Yahud 2020-11-19 10:13:49 UTC
I think I have a solution for this, testing it right now

Comment 3 Omer Yahud 2020-11-19 15:40:54 UTC
Upstream PR: https://github.com/kubevirt/common-templates/pull/287

Comment 5 Omer Yahud 2020-11-19 16:43:05 UTC
This is an oc command to workaround the issue:
---
oc label template win2k12r2-desktop-large-v0.11.3 \
        win2k12r2-desktop-medium-v0.11.3 \
        win2k12r2-server-large-v0.11.3 \
        win2k12r2-server-medium-v0.11.3 \
        windows-server-large-v0.11.3 \
        windows-server-large-v0.12.3 \
        windows-server-medium-v0.11.3 \
        windows-server-medium-v0.12.3 \
        os.template.kubevirt.io/win2k12r2- \
        os.template.kubevirt.io/win2k16- \
        os.template.kubevirt.io/win2k19- \
        os.template.kubevirt.io/win10- \
        workload.template.kubevirt.io/server- \
        workload.template.kubevirt.io/desktop- \
        flavor.template.kubevirt.io/large- \
        flavor.template.kubevirt.io/medium-
---
It removes the labels the UI is looking for from the bad templates.

Comment 6 Ruth Netser 2020-12-13 12:28:36 UTC
Verified with kubevirt-ssp-operator-container-v2.5.2-5:
Windows PVC can be attached to a template (see screenshot).
Opened bug 1907183

Comment 7 Ruth Netser 2020-12-13 12:29:48 UTC
Created attachment 1738700 [details]
Acreenshot after upgrade

Comment 13 errata-xmlrpc 2020-12-16 00:16:58 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 (OpenShift Virtualization 2.5.2 Images), 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:5560