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

Add preserve_mac_address option to vm_clone module #187

Closed justinc1 closed 1 year ago

justinc1 commented 1 year ago

As requested in #163. We want to be able to clone VM, and easily keep MAC address unmodified.

The class NicType was refactored, to be able to convert NIC type between ansible and HyperCore, in either direction. It does not need to be enum.Enum derived (in fact, I hade some problems with mypy - I think mypy was just not able to figure out what might methods return).

The NIC._handle_nic_type method is used in 2 places only. It will be replaced by NicType.hypercore_to_ansible(). The change is small, but it requires changing unit tests. Currently unittests mock data containt string "virtio" for HyperCore returned data - this is wrong, it should be "VIRTIO". The complete change is then bigger, so it will be in separate PR - #188.