ScaleComputing / HyperCoreAnsibleCollection

Official Ansible collection for Scale Computing SC//HyperCore (HC3) v1 API
GNU General Public License v3.0
12 stars 8 forks source link

:lady_beetle: Bug: `primaryDrive` uuid should not be specified, uuid should not be created on POST #339

Closed kbothwell closed 14 hours ago

kbothwell commented 3 days ago

Describe the bug

When creating a VM with disks attached a UUID is included called with a value of "primaryDrive". The HyperCore cluster receives the information like so:

2024/10/31 23:42:08.901 info  rest.js:96                          | Path: /v1/VirDomain, Method: POST, Request Body: {"dom":{"blockDevs":[{"cacheMode":"WRITETHROUGH","type":"VIRTIO_DISK","capacity":10844792422,"uuid":"primaryDrive"},{"cacheMode":"WRITETHROUGH","type":"IDE_CDROM","capacity":0,"path":"scribe/ee7a902d-bbaa-4a7d-b9da-8f9631f5039e"}],"bootDevices":[],"description":"Demo VM","mem":536870912,"name":"vm-integration-test-vm","netDevs":[{"vlan":1,"type":"RTL8139"},{"vlan":2,"type":"VIRTIO"}],"numVCPU":2,"tags":"Xlab,mytag1,mytag2","operatingSystem":"os_windows_server_2012"},"options":{"attachGuestToolsISO":false,"machineTypeKeyword":"bios"}}, Status: 400 Response: 0.001s

When an OpenAPI enforcer is used the request errors 400 as a bad request. Cannot write to a read only property

TASK [Create and start the VM with disks, nics and boot devices set. Attach ISO onto the VM.] ***
fatal: [sez04a-01.lab.local]: FAILED! => {"changed": false, "msg": "Unexpected response - 400 b'Request has one or more errors\\n  In body\\n    For Content-Type application/json\\n      Invalid value\\n        at: dom > blockDevs > 0\\n          Cannot write to read only properties: uuid'"}

The vm.py module contains a function called _post_vm_payload_set_disks which sets the first disk that isn't a CDROM drive to have a uuid of primaryDrive.

To Reproduce Steps to reproduce the behavior:

  1. create a vm using hypercore.vm

Expected behavior

There should be no attempt to create a UUID.

Screenshots

If applicable, add screenshots to help explain your problem.

System Info (please complete the following information):

Additional context

Add any other context about the problem here.

justinc1 commented 1 day ago

Hi. Also web UI does set disk UUID when creating a new VM - screenshot of websocket traffic is here. image The collection mimicks what web UI does.

The "OpenAPI enforcer" - is this something that ScaleComputing provides, or is a third party tool?

kbothwell commented 14 hours ago

This issue can be closed. Turns out supplying any string for a block or net device's UUID on virDomain create and referring to it in boot devices is undocumented but desired behavior in the api. The OpenAPI Enforcer is a third party tool that is getting rolled back. Thank you for your attention on this.