Bug 1842958 - [SSP] Fail to create Windows VMs from templates - windows-cd-bus validation added but cdrom is missing from the template
Summary: [SSP] Fail to create Windows VMs from templates - windows-cd-bus validation a...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: SSP
Version: 2.4.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 2.4.0
Assignee: Karel Šimon
QA Contact: Israel Pinto
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-02 12:58 UTC by Ruth Netser
Modified: 2020-07-28 19:10 UTC (History)
4 users (show)

Fixed In Version: kubevirt-ssp-operator-container-v2.4.0-56
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-28 19:10:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt common-templates pull 157 0 None closed added cdrom disk to windows templates 2020-07-30 09:55:36 UTC
Github kubevirt common-templates pull 158 0 None closed added bus attribute to windows cdrom validation rule 2020-07-30 09:55:35 UTC
Red Hat Product Errata RHSA-2020:3194 0 None None None 2020-07-28 19:10:26 UTC

Description Ruth Netser 2020-06-02 12:58:46 UTC
Description of problem:
Windows templates have windows-cd-bus validation, however cdrom elemnt was not added to the template.
Windows VM creation from template fail on:
"reason":"FieldValueInvalid","message":"cd bus has to be sata:  not in [sata]","field":".spec.domain.devices.disks[*].cdrom.bus"}]}

(Creation from UI succeeds as by default cdrom is added to the VM; if reoved, creation would fail there as well.)

Version-Release number of selected component (if applicable):
CNV 2.4, operatorVersion: v0.29.2
OCP 4.5

How reproducible:
100%

Steps to Reproduce:
1. Create a VM using Windows templates


Actual results:
VM creation fails.

Expected results:
Template validations should be met in the templates themselves.

Additional info:

HTTP response body: b'{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"admission webhook \\"virt-template-admission.kubevirt.io\\" denied the request: virto disk bus type has better performance, install virtio drivers in VM and change bus type: sata not in [virtio], cd bus has to be sata:  not in [sata]","reason":"Invalid","details":{"causes":[{"reason":"FieldValueInvalid","message":"virto disk bus type has better performance, install virtio drivers in VM and change bus type: sata not in [virtio]","field":".spec.domain.devices.disks[*].disk.bus"},{"reason":"FieldValueInvalid","message":"cd bus has to be sata:  not in [sata]","field":".spec.domain.devices.disks[*].cdrom.bus"}]},"code":422}\n'

Comment 2 Gilad Lekner 2020-06-03 10:40:29 UTC
Hey Ruth
I just tried running the following command and it succeeded

oc process -f common-templates/dist/templates/windows10-desktop-large.yaml  \ 
    -p NAME=test-win-vm \
    -p PVCNAME=mynewclaim \
    | oc create -f -

Can you share what command failed for you? thanks.

Comment 3 Ruth Netser 2020-06-03 11:21:31 UTC
Template validator will not be used in CLI because template namespace is missing inside the template (bug 1753554).
You need to add "vm.kubevirt.io/template-namespace: openshift" to the template annotations.

Comment 4 Alex Kalenyuk 2020-06-18 12:24:28 UTC
Just tackled this again:

Steps to reproduce:
1) oc process -n openshift windows-server-medium-v0.7.0 -p NAME="win16" -p PVCNAME="win-16-2" -oyaml > win16_vm.yaml
2) edit the yaml:
add "vm.kubevirt.io/template-namespace: openshift" under metadata->labels
3) oc create -f win16_vm.yaml

Actual results:
VM creation fails.
Output:
The request is invalid: 
* .spec.domain.devices.disks[*].disk.bus: virto disk bus type has better performance, install virtio drivers in VM and change bus type: sata not in [virtio]
* .spec.domain.devices.disks[*].cdrom.bus: cd bus has to be sata:  not in [sata]

Expected results:
Template validations should be met in the templates themselves.

Additional info:

Template output:
http://pastebin.test.redhat.com/876516

SSP operator version - v2.4.0-50

Log from template-validator:

{"component":"kubevirt-template-validator","level":"warning","msg":"VM windows-jpj6cl has old-style template namespace labels 'vm.kubevirt.io/template-namespace', should be updated to 'vm.kubevirt.io/template.namespace'","pos":"uplink.go:50","timestamp":"2020-06-18T11:06:21.077564Z"}
{"component":"kubevirt-template-validator","level":"warning","msg":"virto disk bus type has better performance, install virtio drivers in VM and change bus type: rule is not satisfied","pos":"eval.go:68","timestamp":"2020-06-18T11:06:21.079999Z"}
{"component":"kubevirt-template-validator","level":"info","msg":"evalution summary for windows-jpj6cl:\nminimal-required-memory applied: OK, 4294967296 in [536870912, N/A]\nwindows-virtio-bus applied: FAIL, sata not in [virtio]\nwindows-disk-bus applied: OK, sata in [virtio, sata]\nwindows-cd-bus applied: FAIL,  not in [sata]\n\nsucceeded=false","pos":"admission.go:42","timestamp":"2020-06-18T11:06:21.080566Z"}

Comment 5 Ruth Netser 2020-06-25 13:20:08 UTC
Verified on CNV-2.4.0, OCP: 4.5.0-rc.2, SSP build 58:
1. Create Windows VM without cd-rom - PASSED (VM is created)
2. Create Windows VM with sata cd-rom - PASSED (VM is created)
3. Create Widnows VMw with virtio cd-rom - PASSED (VM creation fails on cd-rom validation)

From the UI - create a VM with cd-rom - verify that the only option is "sata"

Comment 8 errata-xmlrpc 2020-07-28 19:10:09 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/RHSA-2020:3194


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