Bug 1917485 - [oVirt] ovirt machine/machineset object has missing some field validations
Summary: [oVirt] ovirt machine/machineset object has missing some field validations
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Cloud Compute
Version: 4.8
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.8.0
Assignee: Douglas Schilling Landgraf
QA Contact: michal
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-18 15:05 UTC by Gal Zaidman
Modified: 2022-02-17 15:55 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-07-27 22:36:15 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github https://github.com/openshift cluster-api-provider-ovirt pull 96 0 None None None 2021-03-10 21:57:13 UTC
Github openshift cluster-api-provider-ovirt pull 96 0 None open Bug 1917485: Add validations to machine object 2021-03-31 16:05:00 UTC
Red Hat Product Errata RHSA-2021:2438 0 None None None 2021-07-27 22:36:33 UTC

Description Gal Zaidman 2021-01-18 15:05:38 UTC
Description of problem:
oVIrt machine object is missing some field validations, and the moment we want to add the following validations:
- UserDataSecret, CredentialsSecret, OSDisk: must always be set (and can't be empty string).
- vmtype must be one of: server, high_performance, desktop
- InstanceTypeId can't be set toghter with CPU or MEM.

Any bad value should add a proper error message in the logs and move the machine into Failed state.

How to test:
Try to challenge the logic and create machinesets with invalid fields, the machine should transition into Failed state with a clear error message on the logs

Comment 1 Gal Zaidman 2021-01-27 12:55:16 UTC
Pushing to next sprint

Comment 2 michal 2021-03-08 11:52:14 UTC
need to add validation to vmtype- I created machineset with wrong machine type and machine was created with a 'provisioning' state. I expect some warning message.

Comment 3 Douglas Schilling Landgraf 2021-03-31 19:24:06 UTC
Provided all my validations steps here: https://github.com/openshift/cluster-api-provider-ovirt/pull/96#issuecomment-811363490

Comment 4 michal 2021-04-12 10:38:48 UTC
ocp version: 
4.8.0-0.nightly-2021-04-09-222447 

steps: 
1) create machineset with empty osDisk value
Actual:
machine created successfully without any validation error. machine in status 'running'


another issue:
1) create machineset with incorrect value on 'instance_type_id' -need to delete field of memory and cpu
2) run 'oc get machines' - machine created on status 'provisioning' 
actual:
machine created on status 'provisioning' instead of failed
 with error -E0412 08:25:31.370505       1 controller.go:267] controller-runtime/manager/controller/machine_controller "msg"="Reconciler error" "error"="creating Ovirt instance: Fault reason is \"Operation failed\". Fault detail is \"Invalid UUID string: MemoryMB\". HTTP response code is \"400\". HTTP response message is \"400 Bad Request\"." "name"="primary-m6qrv-worker-24-2mwkk" "namespace"="openshift-machine-api" 

expected: 
machine should create with a validation error and status failed

Comment 5 Douglas Schilling Landgraf 2021-04-12 18:38:00 UTC
(In reply to michal from comment #4)
> ocp version: 
> 4.8.0-0.nightly-2021-04-09-222447 
> 
> steps: 
> 1) create machineset with empty osDisk value
> Actual:
> machine created successfully without any validation error. machine in status
> 'running'
> 
> 
> another issue:
> 1) create machineset with incorrect value on 'instance_type_id' -need to
> delete field of memory and cpu
> 2) run 'oc get machines' - machine created on status 'provisioning' 
> actual:
> machine created on status 'provisioning' instead of failed
>  with error -E0412 08:25:31.370505       1 controller.go:267]
> controller-runtime/manager/controller/machine_controller "msg"="Reconciler
> error" "error"="creating Ovirt instance: Fault reason is \"Operation
> failed\". Fault detail is \"Invalid UUID string: MemoryMB\". HTTP response
> code is \"400\". HTTP response message is \"400 Bad Request\"."
> "name"="primary-m6qrv-worker-24-2mwkk" "namespace"="openshift-machine-api" 
> 
> expected: 
> machine should create with a validation error and status failed


Hi Michal,

I have sent you an invite (for tomorrow) so we can look together to your env and make sure we are using the right image. Also, could you please share the machineset that you used?

Feel free to re-schedule the meeting invite.

Thanks!

Comment 6 michal 2021-04-13 07:08:52 UTC
machineset:

apiVersion: machine.openshift.io/v1beta1
kind: MachineSet
metadata:
  name: primary-m6qrv-worker-33
  labels:
    machine.openshift.io/cluster-api-cluster: primary-m6qrv
    machine.openshift.io/cluster-api-machine-role: worker-33
    machine.openshift.io/cluster-api-machine-type: worker-33
spec:
  replicas: 1
  selector:
    matchLabels:
      machine.openshift.io/cluster-api-cluster: primary-m6qrv
      machine.openshift.io/cluster-api-machineset: primary-m6qrv-worker-33
  template:
    metadata:
      labels:
        machine.openshift.io/cluster-api-cluster: primary-m6qrv
        machine.openshift.io/cluster-api-machine-role: worker-33
        machine.openshift.io/cluster-api-machine-type: worker-33
        machine.openshift.io/cluster-api-machineset: primary-m6qrv-worker-33
    spec:
      providerSpec:
        value:
          affinity_groups_names:
          - test1
          apiVersion: ovirtproviderconfig.machine.openshift.io/v1beta1
          cluster_id: 502babf8-9c05-4738-b5c9-2ac8c33a9648
          credentialsSecret:
            name: ovirt-credentials
          kind: OvirtMachineProviderSpec
          os_disk:
            size_gb: 120
          template_name: primary-m6qrv-rhcos
          instance_type_id: CPU
          type: server
          userDataSecret:
            name: worker-user-data

Comment 7 michal 2021-04-13 18:30:50 UTC
after talking with Douglas, we decide to separate those bugs into 2 different bugs: 

https://bugzilla.redhat.com/show_bug.cgi?id=1949231

https://bugzilla.redhat.com/show_bug.cgi?id=1949235

I close this bug because all other scenarios verified and works good

Comment 10 errata-xmlrpc 2021-07-27 22:36:15 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 (Moderate: OpenShift Container Platform 4.8.2 bug fix and security 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-2021:2438


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