nutanix / calm-dsl

Keep Calm and DSL On!
https://nutanix.github.io/calm-dsl/
Apache License 2.0
32 stars 51 forks source link

[Bug] Update cache fails if account PC contains non-AHV clusters (ESX) #239

Closed nutken closed 2 years ago

nutken commented 2 years ago

Describe the bug init dsl / update cache will fail if Nutanix PC account contains a mix of AHV and ESX clusters.

Branch/Container Branch tag v3.5.0

To Reproduce Steps to reproduce the behavior:

  1. Configure a Nutanix Account connected to a PC with AHV and ESX clusters
  2. Issue calm update cache
  3. Observe error

Expected behavior Successful completion of init dsl / update cache commands

Findings/Troubleshooting Done In dsl/db/table_config.py:AhvClusterCache.sync it is attempting to create cache entries for AHV clusters. While it removes PC clusters from consideration, it assumes all clusters having the 'AOS' service as being AHV clusters when in fact other hypervisors may have the same attribute. Additional filtering is necessary to remove non-AHV clusters from consideration.

https://github.com/nutanix/calm-dsl/blob/1aedf57e25cb3121c444d445216617e050cb0c97/calm/dsl/db/table_config.py#L421-L435

Changing line 422 as follows resolves the issue.

if "AOS" not in service_list or name not in account_clusters_data_rev:

Screenshots

$ calm update cache
[2022-08-05 20:26:17] [INFO] [calm.dsl.store.cache:157] Updating cache [2022-08-05 20:26:18] [WARNING] [calm.dsl.api.connection:311] Could not get PC Version..
[2022-08-05 20:26:26] [ERROR] [calm.dsl.db.table_config:453] PE Cluster UUID not supplied for AHV PE Cluster ABCD-EF-NTNX01

System Configuration: