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

Fix vm disk remove #252

Closed justinc1 closed 1 year ago

justinc1 commented 1 year ago

Sometimes we can remove disk from a running VM, and sometimes we need to shutdown VM before disk can be removed. It depends on HyperCore thinking VM might be using the disk.

The PR:

Integration tests for all this is included, for vm and vm_disk modules. It covers 3 cases:

A small bug in vm_disk module was also fixed. The module didn't start back VM if it was shutdown during execution.

justinc1 commented 1 year ago

Integ test: https://github.com/ScaleComputing/HyperCoreAnsibleCollection/actions/runs/5464904452 https://github.com/ScaleComputing/HyperCoreAnsibleCollection/actions/runs/5479912287

Edit: in 5479912287 failed vm_clone, looks like a bug. A failed virtual_disk_attach is likely not a bug in collection (but in test).

justinc1 commented 1 year ago

Are the new vm__ and vm_disk__ tests not the same thing?

They are very similar, and both modules use same code from module_utils. But they are not exactly the same, so I added separate tests (and after doing this, I noticed vm_disk module does not correctly restart VMs).