nutanix / nutanix.ansible

Official Nutanix Ansible collections
GNU General Public License v3.0
67 stars 38 forks source link

[Bug] ntnx_vms: New VM: Fragile Code: Specifying Cluster on Non-Multiple Subnet Name Results in Subnet Not Found #387

Open jhowe-uw opened 1 year ago

jhowe-uw commented 1 year ago

https://github.com/nutanix/nutanix.ansible/blob/923e9c76915c55006882df6b0623ffb781ed854d/examples/vm.yml#L35

The code block below states you need to specify the cluster name when the subnet name exists across multiple clusters. However, this puts the onus of detecting multiple subnet names on the user and creates non-DRY ansible playbooks.

Expected:

Stating a cluster name for a subnet should always be successful, regardless if the subnet is a single instance or has multiple instances across clusters.

Actual:

Stating a cluster name on a subnet with no duplicates results in subnet not found

Additional:

Note the misspelling on line 35 of accross ( -> across )

Thanks!

networks:
        - is_connected: True
          subnet:
            name: "{{ subnet_name }}"
            # mention cluster only when there are multiple subnets with same name accross clusters
            # and subnet name is set above
            cluster:
              name: "{{cluster_name}}"
Gevorg-Khachatryan-97 commented 1 year ago

Didn't find the issue. Could you share some steps and versions of environment that you used to reproduce it.

Thanks in advance @jhowe-uw

jhowe-uw commented 11 months ago

We have multiple datacenters.

Within our systems, we have multiple computer clusters sharing common VLANs.

These VLAN names can span multiple compute clusters, so we need to specify the cluster name.

As the code comment says:

"mention cluster only when there are multiple subnets with same name accross clusters"

My request is that the code should always accept the cluster name as an arguement for stating the subnet.

Please let me know if you need further clarification.

Thanks

george-ghawali commented 1 month ago

I have tried creating a VM with a unique subnet name and cluster name, it works as expected. Can you check once if the subnet info has status.cluster_reference.uuid ? We can surely update the comment that cluster name can be passed in any case of VLAN.